Codeigniter comes with a great pagination library. Here, you just need to define the start and limit number.But if you have data over multiple tables and you have know way to join those tables. Then how would be the scenario?
You can get the total data into an array. Then slice your array according to your pagination limit.
foreach ($group_all as $group) {
$data_form_model[$a] = $this->admin_model->all_number_model($group->group_name);
$data_form_model_group_name[$a] = $group->group_name;
$a++;
}
$final_array = array();
foreach ($data_form_model as $val) {
foreach ($val as $val2) {
$final_array[] = $val2;
}
}
$config = array();
$config["base_url"] = base_url() . "admin/all_number/";
$config["total_rows"] = count($final_array);
$config["per_page"] = 10;
$config["uri_segment"] = 3;
$config['num_links'] = 3;
$config['full_tag_open'] = '';
$config['first_link'] = '«';
$config['first_tag_open'] = '
';
$config['first_tag_close'] = '';
$config['last_link'] = '»';
$config['last_tag_open'] = '
';
$config['last_tag_close'] = '';
$config['next_link'] = '→';
$config['next_tag_open'] = '
';
$config['next_tag_close'] = '';
$config['prev_link'] = '←';
$config['prev_tag_open'] = '
';
$config['prev_tag_close'] = '';
$config['cur_tag_open'] = '
';
$config['cur_tag_close'] = '';
$config['num_tag_open'] = '
';
$config['num_tag_close'] = '';
$this->pagination->initialize($config);
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
$data_form_model = array_slice($final_array, $page , $config["per_page"]);
$data["links"] = $this->pagination->create_links();
List of my works:
Technical Support:
If you still face the technical problem, please get support of our highly skilled technical team: garazlab.com.
Wordpress Plugins:
- Real-Time Health Data from Every Where:WP plugin to display real-time health data & increase sale by promoting user specific products according to health information: garazlab.com.
- Woocommerce Stock Notification Builder:Sends desktop, mobile & email notifications with full customization.Build your own product notification system with it: garazlab.com.
Opencart Extensions:
- Product Based Quantity Wise Shipping: Find it here.
- OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
- Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
- Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
- Custom Field Product - add unlimited custom fields to the product form: Find it here.
- Formcaptcha - add captcha on the register page: Find it here.
My Books:
- OpenCart 1.4 Template Design Cookbook.
- Joomla Mobile Development Beginners Guide