Page 1 of 1
.active class to static menu
Posted: Tue Jul 02, 2013 10:02 am
by qwalk
Hi,
I am creating a template without using the {menu}. The menu is designed statically in the template. My code is like this:
Code: Select all
<div class="menu">
<ul class="left-col">
<li>{cms_selflink page="Page1"}</li>
<li>{cms_selflink page="Page2"}</li>
<li>{cms_selflink page="Page3"}</li>
</ul>
<ul class="right-col">
<li>{cms_selflink page="Page4"}</li>
<li>{cms_selflink page="Page5"}</li>
<li>{cms_selflink page="Page6"}</li>
</ul>
</div>
Now, this works fine, but the only problem is, that I want to bold the current active page. Now using the menu manager it was easy because it gave the current page the class .active (or .current, i dont remember), but how do I do the same with this static menu?
Thanks in advance!

Re: .active class to static menu
Posted: Tue Jul 02, 2013 10:49 am
by Jo Morg
Maybe by checking {$page_alias} with Smarty conditionals?

Re: .active class to static menu
Posted: Wed Jul 03, 2013 7:17 am
by qwalk
Jo Morg wrote:Maybe by checking {$page_alias} with Smarty conditionals?

That is a bit out of my teritory. But I don't think that would work either. You see I have a top menu with 6 links, and each of these links have a submenu. The 6 toplinks aren't really pages, they are only internal page redirectors and redirects to the first link in their submenu. So when clicking on a top level link, it isn't really "active". I don't think it would work even if I was using the menu manager {menu} module.
:/ hmm
Re: .active class to static menu
Posted: Wed Jul 03, 2013 7:39 am
by Jo Morg
Well, I don't know about menu manager; I'm not an expert using it, however with Smarty logic and some help from the CGSimpleSmart module you can get the root page of another page, right from the main template.
This is a little something I wrote some time ago.... Just didn't have the time to finish the site yet.... But it's the same logic.
Re: .active class to static menu
Posted: Wed Jul 03, 2013 8:23 am
by qwalk
Thank you, I will definitely take a look at it.
Re: .active class to static menu
Posted: Wed Jul 03, 2013 3:51 pm
by oliverseddon
Could you not just use the {menu} tag but specify your pages?
For example:
<div class="menu">
<div class="left-col">
{menu items='Page1,Page2,Page3'}
</div>
<div class="right-col">
{menu items='Page4,Page5,Page6'}
</div>
</div>
Re: .active class to static menu
Posted: Wed Jul 03, 2013 7:25 pm
by Dr.CSS
If you really need to split pages into 2 different UL you could try using the code on this page to change the UL class for each bundle 3...
Of course you will need to remove a bit of the code as it makes numbered navigation for the cycle plugin...
http://how-i-did-that.com/cgblog/4/15/C ... ation.html