- Posts: 3
COMMUNITY FORUM
K2 Content Module Add 'active' class to <li>
- Trent Schug
-
Topic Author
- Offline
- New Member
Less
More
12 years 3 months ago #109825
by Trent Schug
K2 Content Module Add 'active' class to <li> was created by Trent Schug
I have searched to the end of the internet and cannot find an answer to this and my very limited php knowledge is making this seemingly easy task very difficult.
The file is modules/mod_k2_content/templates/default/default.php around LINE 22
Here is the code:
I simply need to add an 'active' to the class area IF the li is the page I am currently viewing in order to highlight it with CSS.
The file is modules/mod_k2_content/templates/default/default.php around LINE 22
Here is the code:
<li id="" class="<?php echo ($key%2) ? "odd" : "even"; if(count($items)==$key+1) echo ' lastItem'; ?>">
I simply need to add an 'active' to the class area IF the li is the page I am currently viewing in order to highlight it with CSS.
Please Log in or Create an account to join the conversation.
- jean-philippe
-
- Offline
- Premium Member
- [email protected]
12 years 3 months ago #109826
by jean-philippe
Replied by jean-philippe on topic Re: K2 Content Module Add 'active' class to <li>
Hi Trent Schug,
it's not possible to get easier if the current items is "active" or not..
but... you can get the Item listing id with:
it's not possible to get easier if the current items is "active" or not..
but... you can get the Item listing id with:
Emond, Jean-Philippe
Please Log in or Create an account to join the conversation.
- Trent Schug
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 3
12 years 3 months ago #109827
by Trent Schug
Replied by Trent Schug on topic Re: K2 Content Module Add 'active' class to <li>
Hmmm, that doesn't seem to work. Any other ideas would be greatly appreciated.
Thanks!
Thanks!
Please Log in or Create an account to join the conversation.
- jean-philippe
-
- Offline
- Premium Member
- [email protected]
12 years 3 months ago #109828
by jean-philippe
Replied by jean-philippe on topic Re: K2 Content Module Add 'active' class to <li>
Hi Trent,
My mistake i've try and I got it:
try this :
My mistake i've try and I got it:
try this :
Emond, Jean-Philippe
Please Log in or Create an account to join the conversation.
- Trent Schug
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 3
12 years 3 months ago #109829
by Trent Schug
Replied by Trent Schug on topic Re: K2 Content Module Add 'active' class to <li>
YES!! Thank you!
That worked perfectly! :)
That worked perfectly! :)
Please Log in or Create an account to join the conversation.
- Paul Davis
-
- Offline
- New Member
Less
More
- Posts: 6
12 years 2 months ago #109830
by Paul Davis
Replied by Paul Davis on topic Re: K2 Content Module Add 'active' class to <li>
Hi Jean-Phillipe,
Will this work when SEF URLs are on? I've tried this and it doesn't seem to work.
Regards
Paul
Will this work when SEF URLs are on? I've tried this and it doesn't seem to work.
Regards
Paul
Please Log in or Create an account to join the conversation.