![]() |
Routing 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: Routing problem (/showthread.php?tid=5047) |
Routing problem - El Forum - 01-02-2008 [eluser]hostingx[/eluser] Hello all! Problems again, When people add comments to my blog, i want them to be send back to the blog item, but here comes the problem, when i use the validation class/helper, i need to use: $this->load->view('viewname'); But that means i cant give an ID with the uri, so the application knows what blog entry he need to load, here the code i have untill now: Code: function add_comment() I hope you people can help me out :o Routing problem - El Forum - 01-02-2008 [eluser]tonanbarbarian[/eluser] Code: $this->db->insert_id(); If your Add_comment method only ever adds, not updates, the comments then you can simply use the above code to determine the id My suggestion would be to put some clode in the model to store the id as a property of the model i.e. Code: function Add_comment($blog_entry) { Then in your controller you can find the id by Code: $this->blog_model->id; If Add_comment can be used to update as well as insert then you need a bit more logic to determine if this is a new or exiting record, but this should be a good start for you Routing problem - El Forum - 01-02-2008 [eluser]Phil Sturgeon[/eluser] What are you talking about? Show them the view if they need to see the form, if they are done use redirect and grab the $this->uri->segment(3) as you are already doing. |