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.

Current page conditional

March 28, 2011 1:02pm

Subscribe [3]
  • #1 / Mar 28, 2011 1:02pm

    lttc

    51 posts

    I’m using segment names (forced, not related to template) to populate a menu depending on where you are. The “Freebie” add-on help me do that.

    But I can’t make work a conditional to put a class on the menu link of the current page.

    Tried many things but nothing work. Maybe the Freebie add-on break something here…

    Any idea ?

    Thanks !

  • #2 / Mar 29, 2011 8:01am

    John Henry Donovan

    12339 posts

    lttc,

    I am not familiar with that add-on so can’t help you there.

    What does your URL looks like?

    This is how I would do it if my URL looked like this

    http://www.mydomain.com/index.php/services/web-design

    <a href="http://{path=%27services/web-design%27}" class="{if segment_2 == web-design}nav_on{/if}">Web Design</a>
  • #3 / Mar 30, 2011 1:03pm

    lttc

    51 posts

    That’s perfect to populate the menu, but what I mean is to put a “you are here” class on the menu link of the actual page.

    Something like this :

    <div {if last_segment == 'url_title'}class="current"{/if}><a href="http://{url_title_path=csss-hsm/statique/cssshsm/portrait/}">{titre_navigation_statique}</a></div>

    But it doesn’t work…

    So let’s say that when you are at “csss-hsm/statique/cssshsm/portrait/” you get a menu with 3 links : 1, 2 and 3

    When you are at : csss-hsm/statique/cssshsm/portrait/3, I want the 3 link in the menu to get the “current” class…

    Note that the freebie add-on makes the segment 3 and 4 invisible to EE… They are called freebie_3 and freebie_4 instead of segment_x…

  • #4 / Mar 31, 2011 10:53am

    Sue Crocker

    26054 posts

    Hi, lttc. Since this is a third party plugin, you may want to go to the author for support on this. In the mean time, moving to the CodeShare Corner.

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

ExpressionEngine News!

#eecms, #events, #releases