CodeIgniter Forums
codeigniter as cms - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: codeigniter as cms (/showthread.php?tid=27530)



codeigniter as cms - El Forum - 02-13-2010

[eluser]polipspy[/eluser]
Hi, I have this problem with codeigniter uri.

I wanted my uri to be like these:

domain.com/about-us
domain.com/contact-us
domain.com/services

instead of these

domain.com/page/about-us
domain.com/page/contact-us
domain.com/page/services

I wanted to pull the data for each page from the default controller like this

function index($slug){
$data['content'] = $this->pagemodel->_get_page($slug);
$this->load->view('template',$data);
}

I also have these in my routes

$route['page:any'] = "page/index/$1";

For example if I go to this page domain.com/about-us but did not create a controller for it, Codeigniter returns a 404.

It would really be nice if Codeigniter checks for methods in the default controller if the controller for the page does not exist.


Thanks.


codeigniter as cms - El Forum - 02-13-2010

[eluser]SitesByJoe[/eluser]
For my own pages controller I run everything through one method named "_remap()" where I then apply my page handling logic.

It removes the need for "index".

Hopefully that helps - _remap() is in the user guide.