Hi,
My problem is that I have a navigation menu embedded on a page to display page content. The menu is dynamically created using the following:
{exp:channel:entries channel="pages" status="open" category="134" orderby="priority" sort="asc" dynamic="no"}
<li><a href="http://{title_permalink=site/about}">{title}</a></li>
{/exp:channel:entries}Normally I would use this to highlight the current:
{if "{segment_1}" == {url_title} class="current"{/if}but I had to add ‘dymanic=“no”’ because having it enabled meant that only the current menu item showed when the page is rendered. So now finding the {url_title} doesn’t work.
I’ve tried the solution on this page: http://ellislab.com/forums/viewthread/89951/P15 which is to:
Find the current from the URL segment on the display page:
{exp:channel:entries channel="pages" status="open" limit="1" url_title="{last_segment}"}And add the class using an ‘if’ statement based on the ‘current’ variable:
<li {if "{embed:current}" == "{url_title}"} class="selected"{/if}><a href="http://{title_permalink=site/about}">{title}</a></li>
but this isn’t working as it should, it adds the class to all menu items.
Does anyone know of a way to do this?
Thank you 😊