Hello,
I’m trying to implement a menu using the channel:entries tag. The idea is that I have a channel called “seasons” where each entry is a description of a season (as a theatre with season 2011, season 2012, season 2013, etc.), and I want each season to have a link in the menu which shows on the page no matter what season you are currently looking at, thus giving an easy way to navigate between seasons. Here’s the code I wrote for this:
{exp:channel:entries channel="seasons" sort="asc" limit="3" dynamic="no"}
<li {if embed:selection == "{title}"} class="selected" {/if}>
<a href="http://{url_title_path=seasons}">{title}</a></li>
{/exp:channel:entries}Clicking on the link takes the user to the entry for that season using the seasons template. This menu is a template called “interface/menu” and is embedded in the seasons template using this code:
{embed="interface/menu" selection="{title}"}It all works fine except for the selection part. I want the currently viewed season to be highlighted in the menu, and I tried to do this by setting the selection to {title} and then testing for it in the menu code. I can see several reasons why my approach isn’t working. What I can’t figure out is how to make it work the way i want.
Has anyone else managed to do this, or does anyone have an idea on how I can do this.?