I am working in Codeigniter.
Here is my code which I have written so far to achieve what I am thinking.
View:
<li><a href=" echo $menu->url.'/'.$menu->id " >Gallery</a></li>
Controller:
function view($id){
$content['content'] = $this->MyModel->getContent($id);
$data['header'] = $this->load->view('header', '', true);
$data['content'] = $this->load->view('content', $content, true);
$this->load->view('main_view', $data);
}
Model
function getContent($id){
$this->db->select('page_title, content');
$this->db->from('admin_pages');
$this->db->where('id', $id);
............
return $query;
}
Route
$route['view/(:any)'] = 'mycontroller/view/$1';
What I want to achieve here is, when I click the link in the "View" then it should show me another page with the content of that specific link fetched from the "admin_pages" table based on the parameter "$id" passed to it from the url.
However when I click the link it gives me page not found error.
Any kind of help will be much appreciated.