Reputation: 4049
I am having a trouble coming up with the concept of this. My application is stored in http://localhost
(duh) and I have an admin panel, which can be accessed by going to http://localhost/admin
. I have admin panel menu and one of the menus is Manage Pages, accessed by going to http://localhost/admin/manage_pages
. Manage Pages page brings up results from database which have title, description and ID. Now, my question is, if I want to edit lets say the third row's title, how would I do this? would it be http://localhost/admin/manage_pages/3
? But for that case I would have to create a function in controller? I am confused.
Upvotes: 0
Views: 182
Reputation: 1012
If you like the way the URI is formatted: localhost/admin/manage_pages/3, then the onlt thing you are missing is to accept a variable for your controller function. In this instance I prefer to set a default value if none was passed, and with an if else statement, you have a method that will load the specified page, or load all pages when nothing is passed.
Controller admin:
public function manage_pages($page_id='')
{
if ($page_id == '')
{ LOAD ALL RESULTS }
else
{ LOAD 1 RESULT }
}
Upvotes: 1