[eluser]nielsentomazini[/eluser]
I am sorry everyone to come with something very basic. I am beginning to learn CI, following its User Guide but I don't understand one part of the tutorial.
It is written:
Quote:Adding logic to the controller
Earlier you set up a controller with a view() method. The method accepts one parameter, which is the name of the page to be loaded. The static page templates will be located in the application/views/pages/ directory.
In that directory, create two files named home.php and about.php. Within those files, type some text − anything you'd like − and save them. If you like to be particularly un-original, try "Hello World!".
In order to load those pages, you'll have to check whether the requested page actually exists:
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 created all the pages that the tutorial teaches (pages.php, header.php. footer.php, home.php, about.php), but I did not understand where should I write this code above.
Where should it go?
Thanks in advance for any help.