Welcome Guest, Not a member yet? Register   Sign In
Static Pages Tutorial
#1

[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 ?
#2

[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 ?
#3

[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




Theme © iAndrew 2016 - Forum software by © MyBB