I extends CI_pagination in MY_pagination library. its working fine offline in wamp. But i dont know why it is not working online on live server.
MY_pagination.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_pagination extends CI_pagination {
protected $CI;
public function __construct() {
parent::__construct();
// reference to the CodeIgniter super object
$this->CI =& get_instance();
}
public function table_pagination($page_url, $total_rows, $per_page)
{
$config = array(
'base_url' => $page_url,
'total_rows' => $total_rows,
'per_page' => $per_page,
'use_page_numbers' => TRUE,
'num_links' => 2,
'next_link' => 'Next',
'prev_link' => 'Previous',
'reuse_query_string' => true,
'first_link' => false,
'last_link' => false,
'full_tag_open' => '<ul class="pagination">',
'full_tag_close' => '</ul>',
'next_tag_open' => '<li class="paginate_button next" id="example1_next">',
'next_tag_close' => '</li>',
'prev_tag_open' => '<li class="paginate_button previous" id="example1_previous">',
'prev_tag_close' => '</li>',
'cur_tag_open' => '<li class="paginate_button active"><a>',
'cur_tag_close' => '</a></li>',
'num_tag_open' => '<li class="paginate_button">',
'num_tag_close' => '</li>'
);
$this->CI->pagination->initialize($config);
return $this->CI->pagination->create_links();
}
public function home_pagination($page_url, $total_rows, $per_page)
{
$config = array(
'prefix' => 'page/',
'base_url' => $page_url,
'total_rows' => $total_rows,
'per_page' => $per_page,
'use_page_numbers' => TRUE,
'num_links' => 2,
'next_link' => '<img src="'.base_url('assets/images/arrow-next-small.png').'" alt=""/>',
'prev_link' => '<img src="'.base_url('assets/images/arrow-pre-small.png').'" alt=""/>',
'reuse_query_string' => true,
'first_link' => false,
'last_link' => false,
'full_tag_open' => '<div class="pagination">',
'full_tag_close' => '</div>',
'next_tag_open' => '',
'next_tag_close' => '',
'prev_tag_open' => '',
'prev_tag_close' => '',
'cur_tag_open' => '<a href="#" class="active">',
'cur_tag_close' => '</a>',
'num_tag_open' => '',
'num_tag_close' => ''
);
$this->CI->pagination->initialize($config);
return $this->CI->pagination->create_links();
}
}
Home_controller.php
<?php
class Home_controller extends MY_Controller
{
public function __construct()
{
parent::__construct();
$this->load->library('pagination');
$this->load->helper('date');
$this->load->helper('main');
$this->load->helper('cookie');
$this->load->helper('template_helper');
$this->load->helper('db_helper');
$remember_me = get_cookie('user_remember');
_session_login($remember_me);
$this->load->library('session');
// _valid_session_login_check();
// $this->load->model('admin_models/sliders/slider_model');
}
public function index()
{
$controller_base_url = base_url("/front_controllers/home/home_controller/index");
$controller_re_url = base_url("/index");
$uri_values = $this->uri->uri_to_assoc(2);
$search_string = "";
if (isset($uri_values['search'])) {
$search_string = $uri_values['search'];
}
$page_num = 1;
if (isset($uri_values['page'])) {
$page_num = $uri_values['page'];
}
$page_url = $controller_re_url;
if ($search_string !== "") {
$page_url = $page_url . "/search/" . $search_string;
}
if (!isset($uri_values['search'])) {
$search_string = $this->input->get('search');
}
$per_page = 12;
if ($search_string == "") {
$post_list = _get_post_list($per_page, $page_num);
$total_rows = _post_rows_count("active", "");
} else {
$post_list = _post_search($search_string, $per_page, $page_num);
$total_rows = _home_search_rows_count($search_string);
}
$active_post_pagination = $this->pagination->home_pagination($page_url, $total_rows, $per_page);
$cat_list = _get_term_list_post_count('category', 0, 1);
$tag_list = _get_term_list_post_count('tag', 10, 1);
// print_r($post_list);
$urls = array(
'controller_base_url' => $controller_base_url,
'controller_re_url' => $controller_re_url
);
$this->data = array(
'urls' => $urls,
'post_list' => $post_list,
'widget_cat_list' => $cat_list,
'widget_tag_list' => $tag_list,
'active_post_pagination' => $active_post_pagination
);
$this->meta = 'layout/front_layout/normal_meta';
$this->head = 'layout/front_layout/home/home_view_head_section';
$this->body = 'layout/front_layout/home/home_view_content_section';
$this->layout();
}
}
?>
Error
Fatal error: Call to undefined method CI_Pagination::home_pagination() in /home/lovebatth39/public_html/application/controllers/front_controllers/home/Home_controller.php on line 55
I dont know why its not working online. Mainly I am trying to extend pagination library. I already checked Naming system like capital MY_
$config['subclass_prefix'] = 'MY_';
Config file also set to MY_
CI ignoring MY_pagination.php
or MY_pagination.php
completely on live server no matter what I put on file
Try to rename pagination library file to MY_Pagination.php
and change the line below :
class MY_pagination extends CI_pagination {
To
class MY_Pagination extends CI_Pagination {