private function default_config() { /* * When setting up this configuration parameter for datasets, you can * calculate total_pages value as (int)((number_of_records - 1) / records_per_page) + 1 * * Here, number_of_records is, well, total number of records in dataset, * and records_per_page is, well, number of records you will list on one page, ok? */ $config['total_pages'] = 10; $config['window_size'] = 3; /* * Since extended class(es) override initialize() * method, we need to specifically call this class' initialize(). */ Iceo_paginator_base::initialize($config); }
public function initialize($config = array()) { if (is_array($config)) { parent::initialize($config); if (isset($config['base_link'])) { $this->base_link = $config['base_link']; } if (isset($config['rows_per_page'])) { $this->rows_per_page = $config['rows_per_page']; } if (isset($config['total_rows'])) { $this->total_rows = $config['total_rows']; } } // Calculate how many pages of content there are based on // number of rows in dataset and number of rows that are // going to be shown on each page $this->total_pages = (int) (($this->total_rows - 1) / $this->rows_per_page) + 1; }