Page 1 of 1

LISE pagination active item

Posted: Fri Nov 14, 2025 4:43 pm
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

Re: LISE pagination active item

Posted: Fri Nov 14, 2025 7:20 pm
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>

[SOLVED] Re: LISE pagination active item

Posted: Fri Nov 14, 2025 7:53 pm
by dvertex
Awesome, it works!
Many thanks as always :)