Hide 'previous' on page 1 of pagination

Hi there,

I'm using the pagination on the page list block and I would like to hide the 'previous' link when users are on page 1 of the list, but have it appear again when on page 2, 3 etc. More of an aesthetic than functionality problem :)

I'd also like to remove the default <strong> tags that surround the current page number, I can edit the classes and css using a duplicate version of the file in my blocks directory, but it seems like the strong tag is added elsewhere?

I've been looking through but couldn't find an answer to either of these, any help would be much appreciated.


View Replies: View Best Answer
synlag replied on at Permalink Reply

have a look at the view.php of the block, the strong tag should live there. Duplicate it to the templates folder and make your edits.
This might help (scroll down to custom view templates)


laaaamb replied on at Permalink Reply
Thanks for the help.

I'm actually already using a duplicate file in the templates folder (page list teasers add on) to customise the pagination, what I can't see is how the strong links are added or how to hide the 'previous' tab?

Here is the pagination code I'm looking at

<?php  if ($showPagination): ?>
   <div id="pagination">
      <div class="ccm-spacer"></div>
      <div class="page-list-pagination">
         <span class="pagination-left"><?php  echo $paginator->getPrevious('' . t('Previous')); ?></span>
         <?php  echo $paginator->getPages(); ?>
         <span class="pagination-right"><?php  echo $paginator->getNext(t('Next') . ''); ?></span>
<?php  endif; ?>
laaaamb replied on at Permalink Reply
Blenderite replied on at Permalink Reply
Not know a lot about PHP, I would think that you would use a if statement for the pagination-left span there. You would need it to know what page you were on. Once you knew that, you could then create a if statement telling it to not display if the page number was equal to 1. Otherwise it would display.

Since I am not a PHP guy, I don't know if this will work, but I would think it would.
jdmackay replied on at Permalink Best Answer Reply
I think the strong tags probably come from the pagination.php helper in concrete/helpers, around line 230.

edit: It looks like the "previous" link is generated in this php too, so I guess what you need to do is override the pagination.php helper. Apparently overriding helpers wasn't possible, but a post athttp://www.concrete5.org/community/forums/customizing_c5/include-pa... suggests that this can now be done.
laaaamb replied on at Permalink Reply
That worked. Thanks a lot!!

That link you sent is out of date I think, I was able to modify the pagination.php file by duplicating it from concrete/core/helpers/ over to mysite/helpers/ without doing the other stuff mentioned there. Though being a bit new to this I may have done this incorrectly.

I removed the <strong> tags from pagination.php. Getting rid of the 'previous' link can be done through css as the pagination.php file wraps the inactive link in a span class - <ltgray> though you can change the name of this class in the pagination.php if you wish.