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.

Make an active link if {segment}

August 05, 2009 6:38pm

Subscribe [1]
  • #1 / Aug 05, 2009 6:38pm

    IschaGast

    56 posts

    On this page http://janhekmanschool.nl/nieuws/archief/2009/ there are some yearly navigation links.

    What I want is that when you click on 2009 the link has a different class then the 2008 link. I tried some thing like this but it won’t work.

    {exp:weblog:entries weblog="{template_group}" dynamic="off" disable="pagination|trackbacks|member_data"}
        {date_heading display="yearly"}
        {if location={segment_3}}
        <li><strong>{entry_date format="%Y"}</strong></li>
        {if:else}
        <li><a href="http://{path=">{entry_date format="%Y"}</a></li>
        {/if}
        {/date_heading}
    {/exp:weblog:entries}

    I hope someone knows how to get this working…

    Update:
    I got it working with this code:

    {exp:weblog:entries weblog="{template_group}" dynamic="off" disable="pagination|trackbacks|member_data"}
        {date_heading display="yearly"}
        {if segment_2==year}
        <li><strong>{entry_date format="%Y"}</strong></li>
        {if:else}
        <li><a href="http://{path=">{entry_date format="%Y"}</a></li>
        {/if}
        {/date_heading}
    {/exp:weblog:entries}
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases