Welcome Guest, Not a member yet? Register   Sign In
Pagination doesn't work if the controller is inside the (sub)folder?
#1

[eluser]Unknown[/eluser]
I have a folder which name is "administrator" inside the "controllers" folder.
Inside the "administrator" folder i have a Test controller.
Inside this controller I want to use the pagination library.
The code looks like this:
Code:
<?php
class Test extends CI_Controller {
public function index() {
  $this->load->library("pagination");
  $config["base_url"] = base_url("administrator/test/index");
  $config["total_rows"] = $this->db->get("slideshow")->num_rows();
  $config["per_page"] = 2;
  $config["num_links"] = 5;

  $this->pagination->initialize($config);
  $data["query"] = $this->db->get("slideshow", $config["per_page"], $this->uri->segment(4));
  $this->load->view("administrator/test/test",$data);
}
}
?>
but when I go to localhost/mywebsite/administrator/test the pagination won't work.I have 15 records within the database, so it should have 8 pages. But it show me only 6 page, and always the first (1) page is active, the "next" link is not working, etc.
But if I make a new controller inside the "controllers" folder (url: localhost/mywebsite/test), which is almost the same, I just change the $config["base_url"] to base_url("test/index"); and $this->uri->segment(4) to $this->uri->segment(3) it works perfectly.
So my question is: can't i use pagination if my controller is inside the folder? | What is wrong with my code?
Thanks for the help.


Messages In This Thread
Pagination doesn't work if the controller is inside the (sub)folder? - by El Forum - 06-25-2014, 07:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB