Changeset 2097
- Timestamp:
- 02/21/2008 11:02:24 AM (8 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
application/controllers/examples.php (modified) (1 diff)
-
system/libraries/Pagination.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/application/controllers/examples.php
r2088 r2097 261 261 echo 'Classic style: '.$pagination; 262 262 263 // You can also use the create_links() method and pick a style on the fly if you want264 echo '<hr />Digg style: '.$pagination-> create_links('digg');265 echo '<hr />Extended style: '.$pagination-> create_links('extended');266 echo '<hr />PunBB style: '.$pagination-> create_links('punbb');263 // You can also use the render() method and pick a style on the fly if you want 264 echo '<hr />Digg style: '.$pagination->render('digg'); 265 echo '<hr />Extended style: '.$pagination->render('extended'); 266 echo '<hr />PunBB style: '.$pagination->render('punbb'); 267 267 echo 'done in {execution_time} seconds'; 268 268 } -
trunk/system/libraries/Pagination.php
r2029 r2097 19 19 protected $items_per_page = 10; 20 20 protected $total_items = 0; 21 protected $auto_hide = FALSE; 21 22 22 23 // Automatically generated values … … 117 118 * @return string pagination html 118 119 */ 119 public function create_links($style = NULL)120 public function render($style = NULL) 120 121 { 121 $style = (isset($style)) ? $style : $this->style; 122 $view = new View($this->directory.$style, get_object_vars($this)); 123 return $view->render(); 122 // Hide single page pagination 123 if ($this->auto_hide == TRUE AND $this->total_pages <= 1) 124 return ''; 125 126 if ($style === NULL) 127 { 128 // Use default style 129 $style = $this->style; 130 } 131 132 // Return rendered pagination view 133 return View::factory($this->directory.$style, get_object_vars($this))->render(); 124 134 } 125 135 … … 131 141 public function __toString() 132 142 { 133 return $this-> create_links();143 return $this->render(); 134 144 } 135 145
