Welcome Guest, Not a member yet? Register   Sign In
Static Pages 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 ?


Messages In This Thread
Static Pages Tutorial - by El Forum - 08-11-2013, 11:49 PM
Static Pages Tutorial - by El Forum - 08-12-2013, 03:09 AM
Static Pages Tutorial - by El Forum - 08-12-2013, 03:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB