CodeIgniter Forums
Static Pages Tutorial - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Static Pages Tutorial (/showthread.php?tid=58985)



Static Pages Tutorial - El Forum - 08-11-2013

[eluser]davy_yg[/eluser]

Hello,

I am following Static Pages Tutorial in Codeigniter Help Guide.

I did exactly as it said, and did nothing more than what it is written.

When I try to view :

http://localhost/News/index.php/about


404 Page Not Found

The page you requested was not found.

Do I need to add something more than the tutorial ?


Static Pages Tutorial - El Forum - 08-12-2013

[eluser]davy_yg[/eluser]

controllers/pages.php

Code:
<?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);
}
}

I have the following files:

views/templates/header.php
views/templates/footer.php

views/pages/home.php
views/pages/about.php

I try: http://localhost/News/index.php/pages/view


404 Page Not Found

The page you requested was not found.

Why ?


Static Pages Tutorial - El Forum - 08-12-2013

[eluser]Otemu[/eluser]
Hi,

Did you follow the whole tutorial and use routes?? if so then your url should be url http://localhost/News/index.php/about instead of http://localhost/News/index.php/pages/view

Hope that helps