i have to a controller with name about.php in controller folder. now in view folder i have a view with name about.php. in index.php view i want to call that view with the link but it is not calling i am very new to Codeignitor.
This is my calling code in index.php
<a href="<?php echo base_url();?>About/about">About Us</a>
This is my controller code about.php in controller folder.
class About extends CI_Controller {
function index(){
$this->load->view('about');
}
}
Your view should be called about.php
and be in the views
folder.
Your controller is then calling this view (correctly) called about
.
Therefore a correct link to this view would be the following:
<a href="<?= site_url('about'); ?>">About Us</a>
You can read about the differences between base_url
and site_url
here.
Try with this:
<a href="<?php echo base_url();?>index.php/about">About Us</a>