Published by Mijingo

tips icon image

EE Insider Tips
Sponsored by Mijingo's EE 2 Screencasts

ExpressionEngine mini-howtos created by the EE Insider community.

Using URL Segments for Dynamic Navigation

User's avatar
  • Posted by Jason Hudnutt
  • June 07, 2009
  • 3 people have found this tip helpful.

ExpressionEngine allows you to dynamically assign CSS navigation based on arguments passed from the URL segment.

This allows you to use CSS to display the active page based on the URL.

<a href="/about/" class="{if segment_1 == "about"}about about-active{if:else}about{/if}"></a

This is just one method that you can use to your advantage.

As always there is more than one way/use for everything in ExpressionEngine!

fc_arny21:52 on 08.05.2010

2 runway

U also can use segment_1, segment_2 and etc. For instance, if u have ‘forum’ folder and ‘viewthread’ template group u must in index template get {segment_2} and it will be ‘151359’. In general, if EE can not find template in template group it use index template.

Add Your Comment?

You must have an EE Insider account to post comments on Insider Tips. It's fast, easy and hassle-free.

Sign up now (or login).

Search EE Insider Tips
Sponsored By