CodeIgniter Forums
$this->load->view problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: $this->load->view problem (/showthread.php?tid=8769)



$this->load->view problem - El Forum - 05-30-2008

[eluser]Mitja[/eluser]
Code:
if ($this->validation->run() == FALSE)
{
$this->load->view('admin/arrangements_edit/'.$id, $data);
}
else

how can i load view of arrangements_edit.php file when i need a id. If i try like this it said that file admin/arrangements_edit/1.php does not exist


$this->load->view problem - El Forum - 05-30-2008

[eluser]einstein[/eluser]
you need to pass the $id in the url and get it with $this->uri->segment(2) if the id is the 2 second segement.
You need to load the arrangements_edit whiout this: "/'$id".

Hope this helps


$this->load->view problem - El Forum - 05-30-2008

[eluser]Michael Wales[/eluser]
I think you have a misunderstanding in what you are actually trying to accomplish. I simply can't imagine you are going to create a unique view for each and every item that has an ID...

Could you explain what you are attempting so we can point you in the right direction?


$this->load->view problem - El Forum - 05-30-2008

[eluser]steel_slasher[/eluser]
@michael
i think i understand what he is saying he seems to have mixed up the view with the controller

@mitja
the id will be in the url for example www.domain.com/admin/arrangements_edit/1
the controller "admin" will run the function "admin" and pass the id to the function the function will then load the view and send the data regarding the user with the id "1"