Changeset 1535 for trunk/system/libraries/Pagination.php
- Timestamp:
- 12/14/2007 03:27:07 PM (11 months ago)
- Files:
-
- 1 modified
-
trunk/system/libraries/Pagination.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/Pagination.php
r1522 r1535 11 11 12 12 // Config values 13 pr otected$base_url = '';14 pr otected$directory = 'pagination';15 pr otected$style = 'classic';16 pr otected$uri_segment = 3;13 private $base_url = ''; 14 private $directory = 'pagination'; 15 private $style = 'classic'; 16 private $uri_segment = 3; 17 17 protected $items_per_page = 10; 18 protected $total_items = 0; 18 19 19 // Automatically calculated values 20 // Automatically generated values 21 protected $url; 20 22 protected $current_page; 21 23 protected $total_pages; 22 protected $total_items;23 24 protected $current_first_item; 24 25 protected $current_last_item; … … 66 67 $this->directory = trim($this->directory, '/').'/'; 67 68 68 // Don't bother about full base_urls 69 if (strpos($this->base_url, '://') === FALSE) 69 // Start building a generic URL 70 $this->url = ($this->base_url == '') ? Router::$segments : $this->url = explode('/', trim($this->base_url, '/')); 71 72 // Convert uri 'label' to corresponding integer if needed 73 if (is_string($this->uri_segment)) 70 74 { 71 // Default base_url 72 if ($this->base_url == '') 75 if (($key = array_search($this->uri_segment, $this->url)) === FALSE) 73 76 { 74 $this->base_url = url::current(); 77 // If uri 'label' is not found, auto add it to base_url 78 $this->url[] = $this->uri_segment; 79 $this->uri_segment = count($this->url) + 1; 75 80 } 76 77 // Explode base_url into segments 78 $this->base_url = explode('/', trim($this->base_url, '/')); 79 80 // Convert uri 'label' to corresponding integer if needed 81 if (is_string($this->uri_segment)) 81 else 82 82 { 83 if (($key = array_search($this->uri_segment, $this->base_url)) === FALSE) 84 { 85 // If uri 'label' is not found, auto add it to base_url 86 $this->base_url[] = $this->uri_segment; 87 $this->uri_segment = count($this->base_url) + 1; 88 } 89 else 90 { 91 $this->uri_segment = $key + 2; 92 } 83 $this->uri_segment = $key + 2; 93 84 } 94 95 // Create a generic base_url including query string and a {page} placeholder96 $this->base_url[$this->uri_segment - 1] = '{page}';97 $this->base_url = url::site(implode('/', $this->base_url)).Router::$query_string;98 85 } 86 87 // Create a generic URL with query string and {page} number placeholder 88 $this->url[$this->uri_segment - 1] = '{page}'; 89 $this->url = url::site(implode('/', $this->url)).Router::$query_string; 99 90 100 91 // Core pagination values
