CodeIgniter Forums
Create_link() not genrating link properly if used in subfolder controller - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Create_link() not genrating link properly if used in subfolder controller (/showthread.php?tid=6253)



Create_link() not genrating link properly if used in subfolder controller - El Forum - 02-20-2008

[eluser]vaibhav[/eluser]
Hello all,

I am facing one typical behavior of pagination link. i am using below test code in one of my root controller

$this->load->library('pagination');
$this->load->model("jobs",'obj');
$config['base_url'] = $this->config->site_url().'/test/viewdata';
$config['total_rows'] = $this->obj->getjobscount();
$config['per_page'] = 4;
$this->pagination->initialize($config);
echo $this->pagination->create_links();

In the above case i am getting links properly and able to moves forward and backward.

but when i shift this code to sub folder in controller like

$this->load->library('pagination');
$this->load->model("jobs",'obj');
$config['base_url'] = $this->config->site_url().'/admin/test/viewdata';
$config['total_rows'] = $this->obj->getjobscount();
$config['per_page'] = 4;
$this->pagination->initialize($config);
echo $this->pagination->create_links();

In this case i get links but not able to move forward when i click on links

Plz anybody knows solution for the same. its pagination class bug or mistake on my side.

Thanks


Create_link() not genrating link properly if used in subfolder controller - El Forum - 02-26-2008

[eluser]vaibhav[/eluser]
Hello all

I am amazed that i my question is still not been answered by forum... Is anyone who can help me out ????

Thanks


Create_link() not genrating link properly if used in subfolder controller - El Forum - 02-26-2008

[eluser]wiredesignz[/eluser]
Check your routes.
If it worked one time then it is mostly likely a problem with your application settings now.


Create_link() not genrating link properly if used in subfolder controller - El Forum - 02-27-2008

[eluser]vaibhav[/eluser]
hello wiredesignz,

Thx for idea.... Finally i found the reason for the same.

i have to use
$config['uri_segment'] = 4;

as pageno position is changed to 4th compare to default 3

Thanks