Welcome Guest, Not a member yet? Register   Sign In
Dymanic navigation - URL question
#2

[eluser]Otemu[/eluser]
Hi,

Quick example using your code above that should give you an idea that you can improve on:

Controller
Code:
//get segment from url
$getPage = $this->uri->segment(2);
//pass segment to model
$data['pages'] = $this->pages_model->get_page($getPage);

Model
Code:
public function get_page($getPage){
//query database for matching page title
  $query = $this->db->get_where('pages', array('page_title' => getPage));

index_view:
Code:
//display page title as url
foreach($pages as $row){
  echo "<ul>";
  echo "<li><a href="/page/">page_title.">/page/".$row->page_title." </a></li>";
  echo "</ul>";
}


Messages In This Thread
Dymanic navigation - URL question - by El Forum - 09-25-2013, 06:50 AM
Dymanic navigation - URL question - by El Forum - 09-25-2013, 08:22 AM
Dymanic navigation - URL question - by El Forum - 09-25-2013, 11:57 PM
Dymanic navigation - URL question - by El Forum - 09-26-2013, 02:58 AM
Dymanic navigation - URL question - by El Forum - 09-26-2013, 03:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB