CodeIgniter Forums
Noob working through tutorial - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Noob working through tutorial (/showthread.php?tid=64574)

Pages: 1 2


RE: Noob working through tutorial - muckydog - 03-07-2016

(03-06-2016, 05:47 PM)pdthinh Wrote:
(03-06-2016, 11:29 AM)muckydog Wrote: Brand spanking new to CI ...

You have a white space between <? and php, remove it and try again.

O. M. G. !!!!

That's just embarassing! Thanks ever so much!


RE: Noob working through tutorial - muckydog - 03-07-2016

(03-06-2016, 05:51 PM)kenjis Wrote:
(03-06-2016, 03:00 PM)muckydog Wrote: application/controllers/Pages.php

<? php
class Pages extends CI_Controller {

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);
}

}

Probably this has nothing to do with your problem, but
`show_404` is wrong. It should be `show_404()`.
Thanks!