Load pages using URL variables |
[eluser]Rolly1971[/eluser]
i do something like this for one of my sites i am working on. url's look like this: http://www.example.com/pagename my controller reads in the uri segment: $page = $this->uri->segment(1); then passes that variable to a page_model class function: $content = $this->page_model->get_content($page); ofc i do some checking on the uri segment before passing it, but the content itself is stored in a database which this function call retrieves and returns (along with some per page settings) once the content is returned it is passed to My_Controller that finishes up with it and send the page to the browser. so my controller looks something like this: notes: My_Controller class resides in application/core and extends CI_Controller, all my controllers in application/controllers extend from it. Code: class Welcome extends MY_Controller { |
Messages In This Thread |
Load pages using URL variables - by El Forum - 02-11-2012, 11:15 AM
Load pages using URL variables - by El Forum - 02-11-2012, 05:44 PM
|