Im fairly new to codeignighter and have been trying to make a little Header, content, footer Template.
im currently having a little issue pointing to other views. Heres what i got for code
My head.php
<html>
<head>
<title>TEST HEADER</title>
</head>
My content (main.php)
<body>
<a href="views/page1.php">Hello World</a>
<a href="page2.php">LINK2</a>
<br><br>
My footer.php
the footer
</body>
</html>
Now the whole deal im having is that i want to link to a inner page (page1.php), i have it setup as a php file in the views folder
page1.php
<?php $this->load->view('head'); ?>
<a href="main.php">back</a>
<br><br>
<?php $this->load->view('footer'); ?>
I would like to be able to make subpages like this and just inject the header and footer into them. But everytime i try linking to this page1.php from the main, i get a message "The requested URL /CI_Test/views/page1.php was not found on this server." but the file is there?
im a bit confused, any help is appreciated!
Try using <?=site_url('page1.php')?>
in main.php:
<a href="<?=site_url('page1.php')?>">Hello World</a>
But it's likely that your problem is due to routing and .htaccess mod_rewrite. For CodeIgniter to work, the .htaccess file tells your server to reroute all requests (with a few exceptions depending on setup) to index.php, and CodeIgniter then routes the request to a corresponding controller which renders the view.
Try reading the CI documentation, e.g. about static pages: http://ellislab.com/codeigniter/user-guide/tutorial/static_pages.html