LISE pagination active item

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
dvertex
New Member
New Member
Posts: 5
Joined: Sun May 25, 2025 12:17 pm

LISE pagination active item

Post by dvertex »

Hi all,

Here is my code (slightly modified) for LISE pagination summary template

Code: Select all

{if $pagecount > 1}
	<!-- pagination -->
        <div class="paginationWrapper">
	    <ul class="pagination">
		{if $pagenumber > 1}
                        <li class="page-item"><a class="page-link" href="{$prevurl}">Previous</a></li>			
		{/if}
			{foreach from=$pagelinks item=page}                                                   
                                <li class="page-item">{$page->link}</li>
			{/foreach}
		{if $pagenumber < $pagecount}
                        <li class="page-item"><a class="page-link" href="{$nexturl}">Next</a></li>
		{/if}
	    </ul>
        </div>
	<!-- pagination //-->
	{/if}
Now I need to add an active class to current pagination list item.
As {$page->link} outputs <a> tag with the number of page. So I thought to somehow compare {$pagenumber} with the current page and add 'active' class.
Any ideas?
Many thanks
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1825
Joined: Wed Feb 25, 2009 4:25 am

Re: LISE pagination active item

Post by DIGI3 »

There's probably better ways to do this, but here's one I quickly came up with:

change

Code: Select all

<li class="page-item">{$page->link}</li>
to

Code: Select all

<li class="page-item {if $page->link|strip_tags == $pagenumber} current{/if}">{$page->link}</li>
Not getting the answer you need? CMSMS support options
dvertex
New Member
New Member
Posts: 5
Joined: Sun May 25, 2025 12:17 pm

[SOLVED] Re: LISE pagination active item

Post by dvertex »

Awesome, it works!
Many thanks as always :)
Post Reply

Return to “Modules/Add-Ons”