Can any one tell me wahat went wrong here. I am writing a code for pagination using codeigniter pagination library and every thing works perfect except the page links donot take any where. they just add additional uri paths like http://localhost:8081/web/index.php/Public/Main/index/1/1/1 when clicked. Help please.
application/core/ My Controller
public function PAGINATE($total, $per_page) {
$this->load->library('pagination');
$config["base_url"] = $_SERVER['PHP_SELF'];
$config["total_rows"] = $total;
$config["per_page"] = $per_page;
$config["uri_segment"] = 3;
$config["num_links"] = 3;
$config['prev_link'] = 'Previous';
$config['next_link'] = 'Next';
$config['last_link'] = 'Last';
die(print_r($config));
$this->pagination->initialize($config);
$this->data["links"] = $this->pagination->create_links();
}
Controllers/Public/Main/Index
public function index()
{
parent::PAGINATE(sizeof($this->data['homes'] = $this->AppModel->get_all(HOME_TABLE, 200, 0)), 1);
parent::RENDER('Public/Site/Home');
}
Model
public function get_all($table, $limit, $offset){
$this->db->select('*');
$this->db->limit($limit, $offset);
$this->db->from($table);
$query = $this->db->get();
return $query->result_array(); // fetch data
}
View
<div class="page-nav">
<ul>
<li><?php echo $links; ?></li>
</ul>
</div>
http://example.com/index.php/test/page/
). Don't forget ending slash. – Tpojka$links
variable when page is rendered? – Tpojka