Show
Ignore:
Timestamp:
08/29/2007 12:02:58 PM (15 months ago)
Author:
Geert
Message:
  • More bug fixes
  • I added a temporary pagination example to the welcome controller. Go check it out!
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/application/controllers/welcome.php

    r412 r443  
    88                print_r ($db); 
    99        } 
     10         
     11        function pagination_example() 
     12        { 
     13                // You HAVE TO use $this->pagination when initializing the Pagination library. 
     14                // This is because the pagination views call $this->pagination->url(). 
     15                // Problem: what in case your page has multiple pagination areas? Hmm... 
     16                $this->pagination = new Pagination(array( 
     17                        'base_url'       => 'welcome/pagination_example/page/', // page segment doesn't need to be the last one 
     18                        'uri_segment'    => 4, // 'uri_label' => 'page' would have the same result 
     19                        'total_items'    => 254, // use db count query here of course 
     20                        'items_per_page' => 10, // it may be handy to set defaults for stuff like this in config/pagination.php 
     21                        'style'          => 'classic' // pick one from: classic (default), digg, extended, punbb, or add your own! 
     22                )); 
     23                 
     24                // Just echoing it is enough to display the links (__toString() rocks!) 
     25                echo 'Classic style: '.$this->pagination; 
     26                 
     27                // You can also use the create_links() method and pick a style on the fly if you want 
     28                echo '<hr />Digg style:     '.$this->pagination->create_links('digg'); 
     29                echo '<hr />Extended style: '.$this->pagination->create_links('extended'); 
     30                echo '<hr />PunBB style:    '.$this->pagination->create_links('punbb'); 
     31        } 
    1032 
    1133}