codeigniter - Header not appearing & Footer not correct -


i'm following instructions in codeigniter tutorial on static page header not appear although tab labelled "codeigniter tutorial" , content of footer appears on same line content of page.

this content of pages.php - application/controllers/pages.php

<?php  class pages extends ci_controller  {     public function view($page = 'home')     {     if ( ! file_exists(apppath.'/views/pages/'.$page.'.php'))             {             // whoops, don't have page that!             show_404();             }      $data['title'] = ucfirst($page); // capitalize first letter      $this->load->view('templates/header', $data);     $this->load->view('pages/'.$page, $data);     $this->load->view('templates/footer', $data);     }  } 

this content of header.php - application/views/templates/header.php

<html>     <head>             <title>codeigniter tutorial</title>     </head>     <body>              <h1><?php echo $title ?></h1> 

this content of footer.php - application/views/templates/footer.php

            <em>&copy; 2014</em>     </body>  </html> 

this content of routes.php - application/config/routes.php

$route['default_controller'] = 'pages/view'; $route['(:any)'] = 'pages/view/$1'; $route['404_override'] = ''; $route['translate_uri_dashes'] = false; 

this 1 url http://localhost/myproject/index.php/pages/view

and result;

home

hello world! © 2014

and other url http://localhost/myproject/index.php/pages/view/about

and result;

about

hello world! © 2014

i've checked every page numerous times, tried re-booting, , tried browser, , tried codeigniter forum, no avail.

can explain i'm going wrong?


edited

in header.php file i've changed

<h1><?php echo $title ?></h1> 

to

<h3><?php echo $title ?></h3> 

which makes word "home" decreases in size. file can find word "home" pages.php

public function view($page = 'home') 

if change word "codeigniter tutorial" 404 error.

the ie tab labelled "codeigniter tutorial"

i'm unsure if expectations correct, result i'm expecting (but "© 2014" @ bottom of page);

codeigniter tutorial

hello world!

© 2014

it seems files views/pages/about.php , views/pages/home.php empty. try writing in them, example:

views/pages/about.php

<i>this page</i> 

if file exist, empty, should result you're seeing, because line not render anything:

$this->load->view('pages/'.$page, $data); 

if files don't exist, should 404 output - that's bit weird. happen if file application/errors/error_404.php empty.


Comments