[eluser]Unknown[/eluser]
Hi,
I'm having trouble with the tutorial I found in the user guide.
I'm using LAMP under Ubuntu 11.04 and as far as I can tell everything is install and configured correctly on the lamp side of things.
I have made a test.php;
Code:
<?php phpinfo(); ?>
I placed this file in the root of the domain and when I execute it, I get the expected results.
I made the controller file application/controllers/pages.php which included the following code;
Code:
<?php
class Pages extends CI_Controller {
public function view($page = 'home')
{
}
}
I then made the header template application/views/templates/header.php which included the following code;
Code:
<html>
<head>
<title><?php echo $title ?> - CodeIgniter 2 Tutorial</title>
</head>
<body>
<h1>CodeIgniter 2 Tutorial</h1>
Next I made application/views/templates/footer.php with the following code;
Code:
<strong>© 2011</strong>
</body>
</html>
I then created application/views/pages/home.php and application/views/pages/about.php which contain the following code;
and
I then went back to application/controllers/pages.php and added the the following code;
Code:
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);
}
So the file now looks like this;
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);
}
Now, when I browse to 127.0.0.1/index.php/pages/view I get a blank page, no 404, no error message at all, just a white screen.
I'm stuck as to what to try now, I have gone over and over the code but can't find any issues.
Can anybody see what I have done wrong or perhaps have some advice where/what to check next?
Cheers