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.

Using categories for menu - a little help please

May 19, 2013 6:03pm

Subscribe [2]
  • #1 / May 19, 2013 6:03pm

    Steve Fairhurst

    168 posts

    Evening folks,

    I’m using channel categories to create a menu, which works of a fashion. I need to add and active class to the “a” when the correct entry is open.

    {exp:channel:categories channel="project" style="nested" show_empty="no" id="mainNav"}
                      
    <a href="http://{path=%27work/details/category/{category_url_title}%27}" title="{category_name}">__{category_name}__</a>
    
    {/exp:channel:categories}

    Seems the code strips the conditional…. so insert this in the a tag:

    if segment_4 == “category_url_title” class=“active” /if

    Sadly the if conditional is not working… any ideas why?

    Cheers

  • #2 / May 20, 2013 12:37am

    travisb

    172 posts

    It might have something to do with the way the conditional is formatted, but couldn’t see because of the display problem 😊

    Have you tried variations?:

    {if segment_4 == category_url_title}....
    {if segment_4 == "{category_url_title}"}....
    {if "{segment_4}" == "{category_url_title}"}....
    etc…

     

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

ExpressionEngine News!

#eecms, #events, #releases