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

[eluser]invision[/eluser]
Output when I echo in the index():
Code:
$1::::
#22

[eluser]invision[/eluser]
Would it help if I posted my Model file?
#23

[eluser]tonanbarbarian[/eluser]
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
Code:
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);
  $this->load->vars($data);
  $this->load->view('template');
}
#24

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

WOO-HOOOOOOOOOOOOOOOOO!!!!

That worked!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#25

[eluser]invision[/eluser]
@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