[eluser]the_unforgiven[/eluser]
Hi,
I'm having an issue with the routes of the site I'm building.
Here's my controller, model and view along with what i have tried in the routes based on the CI manual.
Controller:
Code:
// Pages
function pages($path){
$data['navi'] = $this->MPages->getAllPages();
$page = $this->MPages->getPagePath($path);
$data['title'] = $page['name'];
$data['metadesc'] = $page['description'];
$data['metakeywords'] = $page['keywords'];
$data['page'] = $page;
$data['content'] = 'page';
$data['title'] = ucfirst($page['name']);
$this->load->view('template', $data);
}
Model
Code:
function getAllPages(){
$data = array();
$this->db->limit(7);
$Q = $this->db->get('pages');
if ($Q->num_rows() > 0){
foreach ($Q->result_array() as $row){
$data[] = $row;
}
}
$Q->free_result();
return $data;
}
View
Code:
<?php
foreach ($navi as $p) : ?>
<li><a href="<?php echo base_url(); ?><?php echo $p['path']; ?>" title="Home"><?php echo $p['name']; ?></a><span class="line">|</span></li>
<?php endforeach; ?>
Routes
Code:
$route['pages/(:any)'] = 'home/pages/$2';
So my question is based what I have wrote how should my routes look should the client add in more pages?
Help and code samples based on mine code would be highly appreciated, thanks in advance.