I started to try the first tutorial example on http://ellislab.com/codeigniter%20/user-guide/tutorial/static_pages.html.
I always get the Page Not Found Problem! I have read a lot of articles about to solve the problem. But it doesn't matter how often I try the solutions in different forums, it's not working!
Can someone please let me know where my bugs are?
So these are some files I tried:
My routes.php in application/config
$route['default_controller'] = "pages/view";
$route['404_override'] = '';
$route['(:any)'] = 'pages/view/$1';
My pages.php in application/controllers
<?php
class Pages extends CI_Controller{
public function view($page = "home")
{
if ( ! file_exists('application/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);
}
}
My home.php and about.php are on application/views/pages/ and the header.php and the footer.php are on application/views/templates/
Thank you very much!
var_dump($page); return;beforeif(!file_.....? This way we check if this method starts. - Paulif(!file_exists)and let CI handle the missing view how it already does anyway, and see what happens? - Damien Pirsy