I'm having a problem with CodeIgniter. I've checked every possible solution on the internet and seems like nothing helps in my case. I'm not a big pro and it's my first time using CodeIgniter so don't be harsh with me.
routes.php:
$route['default_controller'] = "page";
$route['404_override'] = '';
$route['(:num)'] = "page/index/$1";
page.php:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Page extends CI_Controller {
public function index($id=null) {
$this->load->model('Image','',TRUE);
$this->load->model('Banner','',TRUE);
$image = $this->Image->getImageById($id);
if (empty($image)) {
show_404();
}
//db table `banner` always have three rows
$banners=$this->Banner->getBanners();
$data=array();
$data['image']=$image;
$data['banner']=$banners;
$this->load->view('page_index', $data);
}
}
I have read your problem. You have done mistake while saving the controller.
It should be saved in capital i.e. Page.php
but you have saved as page.php
I think this will work out !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With