Exponent CMS Tutorial - Change link class for current page in navigation.

With this simple Exponent CMS tutorial, you can change the link class for the link in the navigation bar for the current page. For example, if you are on the page "contact", the link to "contact" will be a different style (color for example), then the rest, so users know where they are on the site.

First, open up the page exponentbase/modules/navigationmodule/views/Top Nav.tpl in a text editor. If you cannot edit them directly on the server, first download this file, make your changes, save it again, and upload it. I recommend that you use Filezilla as your FTP client.

Find the line:

<a class="navlink" href="{$section->link}">{$section->name}</a>

Replace that code with:

{if $section->name == $current->name}
<a class="current_navlink" href="{$section->link}">
{$section->name}</a>
 {else}
<a class="navlink" href="{$section->link}">
{$section->name}</a>
 {/if}

Now, in your style.css for your theme, you can change the style of the link for the current page in the navigation bar.

For example, add the following lilne to style.css

.current_navlink { font-weight: bold; }

That's it. You can do many other hacks by going to the modules/modulename/view/something.tpl. These names are defined in index.php (for your theme). Hope this helps.