Static Pages |
I am studying the "Static Pages" in the CodeIgniter Tutorial. I'm stuck what appears to be a simple problem.
I understand everything up to this line - In that directory, create two files named home.php and about.php. Within those files, type some text - anything you’d like - and save them. If you like to be particularly un-original, try “Hello World!”. But then - In order to load those pages, you’ll have to check whether the requested page actually exists: - (I understand the words in that line but despite reading the page many times, I have no idea where to put the following code.) public function view($page = 'home') { if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); } $data['title'] = ucfirst($page); // Capitalize the first letter $this->load->view('templates/header', $data); $this->load->view('pages/'.$page, $data); $this->load->view('templates/footer', $data); } |
Messages In This Thread |
Static Pages - by christaliise - 07-08-2015, 09:55 AM
RE: Static Pages - by Dracula - 07-08-2015, 12:50 PM
RE: Static Pages - by christaliise - 07-09-2015, 02:27 AM
RE: Static Pages - by Dracula - 07-09-2015, 02:45 AM
RE: Static Pages - by christaliise - 07-09-2015, 09:35 AM
RE: Static Pages - by Dracula - 07-09-2015, 09:46 AM
RE: Static Pages - by christaliise - 07-09-2015, 06:31 PM
RE: Static Pages - by christaliise - 07-17-2015, 08:46 AM
|