Keyword

K2 Content Module Add 'active' class to <li>

  • Trent Schug
  • Trent Schug's Avatar Topic Author
  • Offline
  • New Member
More
11 years 8 months ago #109825 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:
<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.

More
11 years 8 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:
					
Emond, Jean-Philippe

Please Log in or Create an account to join the conversation.

  • Trent Schug
  • Trent Schug's Avatar Topic Author
  • Offline
  • New Member
More
11 years 8 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!

Please Log in or Create an account to join the conversation.

More
11 years 8 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 :
					
Emond, Jean-Philippe

Please Log in or Create an account to join the conversation.

  • Trent Schug
  • Trent Schug's Avatar Topic Author
  • Offline
  • New Member
More
11 years 8 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! :)

Please Log in or Create an account to join the conversation.

More
11 years 7 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

Please Log in or Create an account to join the conversation.