Welcome Guest, Not a member yet? Register   Sign In
codeigniter as cms
#1

[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.
#2

[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.




Theme © iAndrew 2016 - Forum software by © MyBB