Welcome Guest, Not a member yet? Register   Sign In
Function within a function
#1

[eluser]Grind[/eluser]
Hi there.

I'm new to codeigniter, I started using it yesterday but I already love it.

To learn codeigniter a bit I've started to create a simple guestbook, including post-edit by the administrator, comment on a post by the administrator etc. Everything is set and it works.
But now I have a question. I want 1 admin-page that can be found at example.com/admin. From there the administrator can choose which part of the side he wants to manage. So for the guestbook he goes to example.com/admin/guestbook and for the photos to example.com/admin/photos. This can easily be achieved, but I get stuck when I try to edit posts in the guestbook with a URI like example.com/admin/guestbook/edit/23 (where the number is the id of the entry).

So my question is: How do I need to build the controller to achieve URI's like this? I've searched on Google and on the forums for this, but I haven't found an answer.

Thanks a lot,
Grind
#2

[eluser]pistolPete[/eluser]
Put the admin controllers in a subfolder called "admin", then you can access them at e.g. http://example.com/admin/guestbook.
#3

[eluser]Grind[/eluser]
I can't get it working. All the controllers are in the '/system/application/controllers'-folder, so I made a subfolder within that folder called 'admin' and created a file called 'guestbook.php'. So now guestbook.php is inside /system/application/controllers/admin. But when I go to example.com/admin I see the same page like example.com. How come?
#4

[eluser]pistolPete[/eluser]
What happens if you access http://example.com/admin/guestbook ?
#5

[eluser]Grind[/eluser]
Ah, it works. I've tried example.com/admin and that gave an error because the default controller wasn't set up. It works like a charm. Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB