0

The code below shows all the pages in that channel active. I just want to show the page the users is on. As it is set up now all the items in the menu are .active. What am I doing wrong.

<div class="panel-body">
<ul class="nav nav-stacked">
{exp:channel:entries channel="{segment_1}" dynamic="no"}
<li class="{if segment_1 == "{segment_1}"}active {/if}"><a href="{comment_auto_path}/{url_title}">{title}</a></li>            
{/exp:channel:entries}
</ul></div>
0
{exp:channel:entries channel="{segment_1}" dynamic="no"}
    <li class="{if last_segment == url_title}active {/if}">
        <a href="{comment_auto_path}/{url_title}">{title}</a>
    </li> 
{/exp:channel:entries}

Comparing last_segment to the entries url_title should give you an accurate match. You're currently comparing to the channel or first segment, which will be the same for all the entries.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.