ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How can i compare the current template (name) against the url(-segment)?

October 11, 2007 9:09pm

Subscribe [2]
  • #1 / Oct 11, 2007 9:09pm

    brubin

    6 posts

    okay,
    I’m pretty new to this and slightly confused, so forgive me if I’m missing the apparent & obvious…

    here’s what i’m looking for:
    I’m templating a bunch of sidebar navigation items, and in order to be able to have a nice and pretty css-rule for the ‘currently active’ or ‘selected’ navigation item (for highlighting, bold typeface and so on, you know…?) I’d like to include a conditional statement that compares the name of the menuitem against the template-name, so i that any matched item receives an “id”-value of -let’s say- “actif”.
    am i trying too hard,
    asking too much,
    or does EE have provisions on offer for that kind of problem,
    that i’m simply unaware of?

    Thank in advance for any hints or help,
    s.

  • #2 / Oct 11, 2007 10:36pm

    aircrash

    293 posts

    You could try something like this:

    <li {if '{segment_2}' == 'here'}class="current"{/if}><a href="http://{path=template_group/here}">Here</a></li>

    Check out this blog entry for another method.

  • #3 / Oct 12, 2007 10:34pm

    brubin

    6 posts

    thanks aircrash, that was helpfull-
    appreciate it!
    s.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases