Pagination in pagelist

Permalink 1 user found helpful
Could anyone help me to get paging in pagelists. I have seen there is a PaginationHelper how can i use this?

MissMarvels
 
MissMarvels replied on at Permalink Reply
MissMarvels
using the code from the searchblok....

In pagelist blok define:
public $reservedParams=array('page=','query=','search_paths[]=','submit=','search_paths%5B%5D=' );


In getPages() in the pagelist blok add:

$pagination = Loader::helper('pagination');
                        //pagination
                        $pageSize=5;
                        $page=intval($_REQUEST['page']);
                        global $c;
                        $cID=$c->getCollectionId();
                        $cPath=$c->getCollectionPath();
                        //clean and build query string from current URI
                        $url=$_SERVER['REQUEST_URI'];
                        if( !strstr($url,'?')) $url.='?';
                        else{
                                //strip non reserved params from query string, leave the unique params
                                $qStr=substr($url,strpos($url,'?')+1);
                                $qStrParts=explode('&',$qStr);
                                $nonReservedQStrParts=array();
poorleno replied on at Permalink Reply
poorleno
Cheers for your post.

Just need to work out how to only paginate a specific area on the page and not every page list.
pjhaggerty replied on at Permalink Reply
pjhaggerty
You could make a theme for the page list block that includes your pagination commands and apply it to those page lists you want pagination-ized.

(wordsmithing is fun)
Dutchwave replied on at Permalink Reply
Dutchwave
I'm not sure where to add the code...
Does it need to be added in the controller.php?
poorleno replied on at Permalink Reply
poorleno
Basically what I did was create a new template in /blocks/page_list/templates with the following code;

<?php 
   defined('C5_EXECUTE') or die(_("Access Denied."));
   $textHelper = Loader::helper("text"); 
   // 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
   $reservedParams = array('page=','query=','search_paths[]=','submit=','search_paths%5B%5D=','all' );
   $pages = $cArray;
   $pagination = Loader::helper('pagination'); 
   //pagination 
   $pageSize=4; 
   $page=intval($_REQUEST['page']);
   #print $page;
   global $c; 
   $cID=$c->getCollectionId();


Then I assigned the template to the page list.

Hope that makes sense. Give me a shout (ben[at]oi[hypen]you[dot]com) if not and Ill try to explain it better.

Cheers.
Dutchwave replied on at Permalink Reply
Dutchwave
Here's my code including thumbnail image in the list. Also some inline css, for pagination layout.

You never now someone might need it.

<?php 
    defined('C5_EXECUTE') or die(_("Access Denied."));
    $textHelper = Loader::helper("text"); 
    // 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
    $reservedParams = array('page=','query=','search_paths[]=','submit=','search_paths%5B%5D=','all' );
    $pages = $cArray;
    $pagination = Loader::helper('pagination'); 
    //pagination 
    $pageSize=6; 
    $page=intval($_REQUEST['page']);
    #print $page;
    global $c; 
    $cID=$c->getCollectionId();
Nip replied on at Permalink Reply
This controller works great with the exception of the thumbnail becomming an emtpy string. I've used an image field property.

I would assume that the imagefield attribute returns an url to the image. Any suggestions how to debug this? (keep in mind that I'm not a programmer, rather a html/css designer)

Thanks in advance
teknotica replied on at Permalink Reply
teknotica
Thanks a lot, that was really helpful! :)
olacom replied on at Permalink Reply
olacom
Just to let you know that I've try the template with 600 pages and it's extremely slow, took like 50 second before returning all the data on every request.
osu replied on at Permalink Reply
osu
@Olacom - did you find a faster solution to this? I need to create a way for visitors to look through around 10 sections with 1000+ pages each section...was thinking this might be a solution, but starting to think not!

Any pointers massively appreciated
olacom replied on at Permalink Reply
olacom
Humm since they added the new block cache system into the last version, I think it does help alot since it cache the data after the first run for x amount of time.

APC help alot too.