hberg539 Posted April 5, 2018 Posted April 5, 2018 (edited) Hello, i'm currently using this setup for my pagination: $results = $baustelle->children("limit=2"); $pagination = $results->renderPager(array( 'nextItemLabel' => "Next", 'previousItemLabel' => "Prev", 'listMarkup' => "<ul class='pagination mg-b-0'>{out}</ul>", 'itemMarkup' => "<li class='page-item {class}'>{out}</li>", 'linkMarkup' => "<a class='page-link' href='{url}'>{out}</a>", 'currentItemClass' => "active" )); echo $pagination; PW generates the following output (see the html-comment <!-- -->): <li class="active MarkupPagerNavFirst MarkupPagerNavFirstNum"> <a href="/test/"> <!-- different markup as in linkMarkup specified --> <span> 1 </span> </a> </li> <li class="MarkupPagerNavLastNum"> <a class="page-link" href="/test/page2"> 2 </a> </li> <li class="MarkupPagerNavNext MarkupPagerNavLast"> <a class="page-link" href="/test/page2"> Next </a> </li> </ul> Is this expected behaivor? How can i add the class "page-link" in the a-tag in the current active page? Thanks! Best regards, Kevin Edited April 5, 2018 by hberg539
Sergio Posted April 5, 2018 Posted April 5, 2018 Hi Kevin! Welcome to the forums. Add the "currentLinkMarkup" to your array, like this: $results = $baustelle->children("limit=2"); $pagination = $results->renderPager(array( 'nextItemLabel' => "Next", 'previousItemLabel' => "Prev", 'listMarkup' => "<ul class='pagination mg-b-0'>{out}</ul>", 'itemMarkup' => "<li class='page-item {class}'>{out}</li>", 'linkMarkup' => "<a class='page-link' href='{url}'>{out}</a>", 'currentLinkMarkup' => "{out}", 'currentItemClass' => "active" )); echo $pagination; 4
hberg539 Posted April 5, 2018 Author Posted April 5, 2018 Thanks, works like a charm. (The "currentLinkMarkup" Parameter is missing in the documentation: https://processwire.com/api/modules/markup-pager-nav/) 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now