A Bootstrap 4 Pagination question

xycofryx

Member
Fabrik: 3.9
Joomla: 3.9.2
Template: Helix Ultimate (Bootstrap 4)
A have a question on how to style the pagination?
I can't seem to find the "<a>" tag where I can put the "page-link" class.
I have tried to copy and create a layout override for the "fabrik-pagination-links.php" but to no avail.
As we all know the structure for the Bootstrap 4 pagination is:
HTML:
<nav aria-label="Page navigation example">
  <ul class="pagination">
   <li class="page-item"><a class="page-link" href="#">Previous</a></li>
  </ul>
</nav>
If you can point me on the proper direction that would be great.
-Sam
 
You didn't see the other files in the same folder? Check out "fabrik-pagination-item-active.php" and "fabrik-pagination-item-inactive.php", that's where the <a> and <span> are.
 
Forgot to mention I did that already on both files ("fabrik-pagination-item-active.php" and "fabrik-pagination-item-inactive.php"), funny because when i inspect them the "page-link" class did not apply. Any idea?
 
Haha, yes, that piece of information was missing from you!

Hmm, the usual checks:
1. What's it looking like with Protostar? Should be default unless someone's been messing with core files.
2. All override files in the right folder? /templates/YOUR_TEMPLATE/html/layouts/com_fabrik/pagination
3. Link to page?
 
Ok, so "page-item" is in use on some of the <li>, but not all, so you'll need to re-visit "fabrik-pagination-links.php".

Then, in the aforementioned two files ("fabrik-pagination-item-active.php" and "fabrik-pagination-item-inactive.php") you seem to have completely removed anything "class". Instead, you want to have class="page-link" attributed to the <a>.

Perhaps get rid of your current override files and start from scratch with fresh copies of the core files in the override folder. Then best go step by step and each time watch the changes in the HTML output?
 
Yup! Currently using your bootstrap 3 override to no avail. Something about "fabrik-pagination-item-active.php" and "fabrik-pagination-item-inactive.php" not applying even in the if being overiden in the components folder.
 
Well, you're almost there:
All <li> have the "page-item" class. Good.

Now only the other two files, and you're done:

fabrik-pagination-item-active.php
Code:
<a title="<?php echo $item->text; ?>" href="<?php echo $item->link; ?>" class="page-link"><?php echo $item->text; ?></a>

fabrik-pagination-item-inactive.php
Code:
$d    = $displayData;
$item = $d->item;
$app  = JFactory::getApplication();

if ($app->isAdmin()) :
    ?>
    <span><?php echo $item->text; ?></span>
    <?php
else :
    ?>

    <span class="page-link"><?php echo $item->text; ?></span>
    <?php
endif;
 
The Fabrik-Joomla-alt-layouts (tested in Purity_III) are applying any change I made in fabrik-pagination-links.php correctly.

But you are right. It seems the layout files
fabrik-pagination-item-active.php
fabrik-pagination-item-inactive.php
aren't used at all. Nothing is changing even if you modify the core files directly.

In fabrik-pagination-links.php $list[...]['data'] contains the link, so you may do some string handling there to add your class.
 
I can't remember why we didn't use those layouts, but the item_active and item_inactive functions can be overridden in the template ...

components/com_fabrik/views/list/tmpl/bootstrap/default_pagination.php

-- hugh
 
Ha, so easy (I didn't check the template:oops:).

But you must create a custom template so the modification won't be overridden by updates.
 
I still don't know why we don't use layouts for that. We obviously created the layouts, 'cos they are there ... but the we didn't use them.

When I get a minute, I'll look at it.

It's probably because there were backward compat issues with people already using custom templates, which would have quit using those overrides if we switched to layouts. But that's a one time pain.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top