Reputation: 515
i am newbie in codeigniter,I am facing a problem while i am trying to navigate my other pages from my index pages...i have make anchor link properly to navigate the page i am wanting..as a exaple..
i want to navigate my reservation
page...then in my index page this link is given like this..
<a href ="book_table.php">Reservation</a>
My book_table
resides in the view
folder of the codeigniter framework and index.php
obviously resides in view
folder too, my controller is just like that..
<?php
class Saffron extends CI_Controller
{
function index()
{
$this->load->view('index');
}
}
Now the problem is that while i am trying to naviagate my reservation
page from the index.php
page its showing 'No page found' that is its not finding the book_table
page.Why its happening?? may b i m missing something here,u r the expert please help me..advance thanks.
Upvotes: 0
Views: 62
Reputation: 4578
You have to create function in controller say "reservation"
function reservation()
{
$this->load->view('book_table');
}
and on index page write like this :-
<a href ="<?php echo base_url();?>saffron/reservation">Reservation</a>
NOTE :-
base_url() - you have to define your site url in application->config->config.php file
$config['base_url'] = 'http://www.example.com/';
Upvotes: 1
Reputation: 9054
first set your base_url() and then when redirecting do something like this:
<a href='<?=base_url()?>home/funct_name' >Navigation</a>
home is the name of your controller
Upvotes: 0
Reputation: 3213
Codeigniter is based on MVC. and your href is just a php file. In MVC it should be some controller and an action of that controller.
Read it here. http://ellislab.com/codeigniter/user-guide/general/urls.html
Upvotes: 0