Simple << 1 2 3 4 5 >> pagination?

Permalink
I'd basically like what you see when you turn on "pagination" in PageList but without the titles. Just click the number and you go to the corresponding page. It's so standard, I assume it must be possible, but I can't figure it out.

 
olliephillips replied on at Permalink Reply
olliephillips
If I understand what you want to achieve, a quick way would be via CSS

.ccm-page-left, ccm-page-right {
 display:none;
}
zoinks replied on at Permalink Reply
I figured out how to make the titles disappear, but unfortunately, this doesn't really give proper pagination. If there are no titles, you wind up with:

<<previous 1 2 3 4 5 6 7 next>>

But, none of the numbers do anything when you press them except turn bold. That is because they are loading in new titles which are now not visible.

I would like the numbers to cycle through the children of a parent page.
TheRealSean replied on at Permalink Reply
TheRealSean
what if you use a custom template on a page list and instead of displaying titles or pagination you display numbers?

Set the Page List to display pages under the parent page and then have it be displayed via page types

you would need to style it up but you would be able to get a link to all children pages with only numbers displayed.

As for the numbers before the page list loop you could add a $i=1; then increment it by one $i++; at the end of the loop.

Then instead of the $cobj->getCollectionName(); echo $i; leaving everything else.
TheRealSean replied on at Permalink Reply
TheRealSean
do you want to display the pagination but not the titles to the pages?
or do you mean the "next/previous" links? then Ollie's answer will do that.

If you wanted to hide the page titles you could just set the css of the pagelist titles to display none. (If i get time today I will see if I can create a custom template which will do this then you can edit that? that is if you don't get there first)

That would hide those and leave the pagination links.

Or and my choice would be to use a custom template that does not output the title.

That would just involve commenting out the section that outputs the titles and leaving the rest as it is and placing that new file in the /root/page_list/templates/custom.php
zoinks replied on at Permalink Reply
I explained what I'm trying to do above in response to olliephillips. Not sure how to do what you're suggesting.

It's basically similar to a slash_separator template I made based of the breadcrumbs template except that rather than page titles, I would like the links to just be numbers. I thought by turning on "pagination" in the PageList that would do it, but what that does instead is just paginate a certain number of page titles to cycle through, which is comically close but absurdly far away from typical pagination.
TheRealSean replied on at Permalink Reply
TheRealSean
Pagination will not display children its used to split up a list over a certain amount of pages

If I understand you right? the following should display only page numbers instead of the titles, I have got rid of the description.




<?php 
   defined('C5_EXECUTE') or die("Access Denied.");
   // now that we're in the specialized content file for this block type, 
   // we'll include this block type's class, and pass the block to it, and get
   // the content
   if (count($cArray) > 0) { ?>
   <div class="ccm-page-list">
   <?php 
   for ($i = 0; $i < count($cArray); $i++ ) {
      $cobj = $cArray[$i];
   ?>   
   <a href="<?php echo $nh->getLinkToCollection($cobj)?>"><?php echo $i+1;?></a>
   <?php } ?>
    </div>
<?php  } ?>
zoinks replied on at Permalink Reply
AWESOME! Thank you! Now, I can just examine what you've done, which makes it much easier on my brain. :)
zoinks replied on at Permalink Reply
This is the part that's really echoing out the i++ array, right?

<?php echo $target?>

Because you created the i++ bit earlier in the code?
TheRealSean replied on at Permalink Reply
TheRealSean
the $i++ bit turns out was already in the code by default, it starts at 0 as it refers to the index, so I have used the $i+1 to get it to start from 1 but not muck up the array of pages.

You could also create your own count but seeing as the $i was already there I just used that.

I hope that makes sense?
TheRealSean replied on at Permalink Reply
TheRealSean
the target is for the external links if a page is an external link but that whole chunk could be removed, I have just taken the core and quickly edited it.
TheRealSean replied on at Permalink Reply
TheRealSean
I think the main bit you are after, slimmed right down to the essentials
just be sure to include the navigation helper
<?php 
   for ($i = 0; $i < count($cArray); $i++ ) {
      $cobj = $cArray[$i]; 
      $title = $i+1;?>
   <a href="<?php echo $nh->getLinkToCollection($cobj)?>"><?php echo $title?></a>
<?php   }
zoinks replied on at Permalink Reply
thanks, the custom page list template you posted earlier would work, though, right? that seems easiest to me because I know exactly how to do it and there is nothing mysterious about it. Loading the nav helper, though, is something I've never used and presumably it is like the other loader elements, such as
<? Loader::element('header_required'); ?>
<? Loader::element('footer_required'); ?>
which do invisible things I do not understand.
TheRealSean replied on at Permalink Reply
TheRealSean
yes it should work I may have missed a closing php tag? im using notepad so no code highlighting.

Looking at the core page list the navigation appears to be loaded in the controller only the text helper is loaded within the view, but I don't think that is needed in your case so yes the top example should work.

So it would appear you can dis-regard my comment with the nav helper :)
zoinks replied on at Permalink Reply
I just noticed something... you mention the "navigation helper"... are you giving me custom template code for a PageList or an AutoNav here (and above). The earlier code you gave did not work and so I turned my attention to this code. This is when I noticed that you are talking about the navigation helper. Since I applied your earlier code as a custom template to a PageList, I suppose that might be why it didn't work, if it was supposed to be applied to an Auto Nav block instead.

EDIT: doesn't matter, the earlier code doesn't work with or without the ending ?> php tag on either the PageList or Auto Nav block. Error on line 22 (last line of code).

So now I guess I will try to see if this alternate code you've given works....
zoinks replied on at Permalink Reply
I get an error on Line 22, which is the very last line. I did try with and without the ending ?> tag which you mentioned in a subsequent post further down the page.

In case I did something wrong, here is what I did:
I used the above code as a Custom Template for the PageList block.

This was the entire code that I used and I named the template numbers_no_titles.php
TheRealSean replied on at Permalink Best Answer Reply 1 Attachment
TheRealSean
Sorry it was my birthday yesterday :) so had a day off,

I have attached a working custom_template which works.

It Just echoes out a number for every page displayed in the page list,

Meaning if pages have subpages these will also be displayed(unless using exclude from subnav)

I have updated the previous example with the working code

ps just needs .txt converting to .php
zoinks replied on at Permalink Reply
Ah, thank you! That DOES work!

Do you know how I can get the <<previous and next>> back on either side of the numbers?

I did like the centered <<previous 1 2 3 4 next >> layout of the pagination.

Come to think of it, this seems like something that would be in either the PageList or Next and Previous buttons by default.

It doesn't seem like the PageList block really follows standard concepts of pagination:
http://www.smashingmagazine.com/2007/11/16/pagination-gallery-examp...
zoinks replied on at Permalink Reply
Ah, thanks. That is what I needed to know is how to call the children and replace the titles with numbers. I'm not that great with PHP, but I have seen this i++ trick before a few times (not that I remember exactly how to do it). I will futz around with this and see if I can get it to work. Thanks!