Reputation: 2015
I am using CI for my web-site. While programming CMS for the same I faced no problem but when I am programming the same for user-end I am getting error as: "404 Page Not Found The page you requested was not found." What am i doing wrong?? Any help/suggestions is warmly welcome.Thank you.
In Controller(model.phpl):
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Model extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->model('user_model');
$this->load->model('common');
$this->load->model('home_model');
$this->load->model('page_model');
}
function _remap($method , $params = array())
{
$this->menu = $this->common->createMenuArr();
$this->index();
}
function index()
{
$data['sliderArr'] = $this->user_model->sliders();
$this->load->view('index', $data);
}
}
In Model(user_model.php):
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class User_model extends CI_Model{
function __construct()
{
parent::__construct();
//$this->load->database();
}
function sliders()
{
$query = $this->db->query("SELECT slider FROM tbl_sliders ORDER BY slider_id DESC")->result_array();
return $query;
}
}
and finally in view(index.php):
<div id="slideContainer">
<div id="slideShim">
<?php
if(!empty($sliderArr))
{
foreach($sliderArr as $slider)
{ ?>
<a href="#"><img src="<?php echo base_url();?>images/sliders/<?php echo $slider['slider'];?>"</a>
<?php }
}
?>
</div>
</div>
Upvotes: 0
Views: 69
Reputation: 1
Go to Application -> Config -> Routes.
And Set $route['default_controller'] = "index"; //whatever your controller name is on which you want your application to route by default
Hope this helps.
Upvotes: 1