Welcome Guest, Not a member yet? Register   Sign In
Load different data depending on URL?

Output when I echo in the index():

Would it help if I posted my Model file?

are you using any url routes?
they may effect the way the params are sent to the index method

you can also try getting the segments manually
function index() {
  $param_1 = $this->uri->segment(3);
  $param_2 = $this->uri->segment(4);
  $param_3 = $this->uri->segment(5);

  echo $param_1.'::'.$param_2.'::'.$param_3.'<br />';

  $data = array('entities'=>array(), 'title'=>'', 'main'=>'public_page');

  if (empty($param_1) && empty($param_2) && empty($param_3)) {
    $data['title'] = 'no specific category chosen';
  } else {
     $data['title'] = !empty($param_1) ? 'country' : $data['title'];
     $data['title'] = !empty($param_2) ? 'city' : $data['title'];
     $data['title'] = !empty($param_3) ? 'category' : $data['title'];

  $data['entries'] = $this->Mains->get_entries($param_1, $param_2, $param_3);

Here's my Routes script:
$route['default_controller'] = "main";
/*$route['page/(:any)/(:any)'] = "page/pages/$2";*/
$route['login'] = "login";
$route[':any'] = "main/index/$1";  
$route['scaffolding_trigger'] = "";


That worked!!!!!!!!!!!!!!!!!!!!!!!!!!!!

@tonanbarbarian Your code worked an absolute treat!!!!!

Here's what I need to do next:

1) Country just lists all the Cities in that Country
2) Cities lists all the Categories for that City
3) Category lists all the Entries for that Category

Is this easy to achieve using your solution above?

Thanks so much again (everyone) for your patience with this. It's really helped me.

Theme © iAndrew 2016 - Forum software by © MyBB