Changeset 443 for trunk/system/libraries/Pagination.php
- Timestamp:
- 08/29/2007 12:02:58 PM (15 months ago)
- Files:
-
- 1 modified
-
trunk/system/libraries/Pagination.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/Pagination.php
r413 r443 3 3 class Pagination_Core { 4 4 5 public $base_url ;5 public $base_url = ''; 6 6 public $style = 'classic'; 7 7 public $uri_segment = 3; … … 40 40 } 41 41 42 // Explode the base_url into segments 43 $this->base_url = explode('/', trim($this->base_url, '/')); 44 42 45 // If a uri_label is given, look for the corresponding uri_segment 43 46 if (isset($this->uri_label)) 44 47 { 45 $uri_label_segment = array_search($this->uri_label, Kohana::instance()->uri->segment_array());48 $uri_label_segment = array_search($this->uri_label, $this->base_url); 46 49 47 50 if ($uri_label_segment !== FALSE) 48 51 { 49 $this->uri_segment = $uri_label_segment + 1;52 $this->uri_segment = $uri_label_segment + 2; 50 53 } 51 54 } 52 55 53 56 // Create a generic base_url with {page} placeholder 54 $this->base_url = (isset($this->base_url)) ? $this->base_url : Kohana::instance()->uri->string();55 $this->base_url = explode('/', $this->base_url);56 57 $this->base_url[$this->uri_segment - 1] = '{page}'; 57 58 $this->base_url = implode('/', $this->base_url); … … 89 90 $style = (isset($style)) ? $style : $this->style; 90 91 91 return (string) new View(' views/pagination/'.$style, get_object_vars($this));92 return (string) new View('pagination/'.$style, get_object_vars($this)); 92 93 } 93 94 … … 98 99 99 100 /** 100 * Returns a URLwith the specified page number101 * Returns the base_url with the specified page number 101 102 * 102 103 * @access public … … 106 107 public function url($page = NULL) 107 108 { 108 $page = (int) (isset($page)) ? $ this->current_page : $page;109 $page = (int) (isset($page)) ? $page : $this->current_page; 109 110 110 111 return str_replace('{page}', $page, $this->base_url);
