Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] This MVC works without $this->uri->segment(n), But Why?
#11

[eluser]CroNiX[/eluser]
Not exactly. It works (automatic passing of variables) for the controller code, not models. Your controller then passes it to the model (as you are doing)

So these would be the same for your controller:
Code:
//current
function article($section)
{
  //$section automatically passed to this controller method
  $data['articles'] = $this->content_model->get_articles($section); //How does this variable is defined with the right idsection?
  $this->load->view('view_article', $data);      
}

Code:
function article()
{
  //$section manually grabbed from URI
  $section = $this->uri->segment(3);
  $data['articles'] = $this->content_model->get_articles($section);
  $this->load->view('view_article', $data);      
}
#12

[eluser]Juan Velandia[/eluser]
Cronix you are very kind, I understand perfectly:

Thanks a lot, I owe you a beer!




Theme © iAndrew 2016 - Forum software by © MyBB