Is this possible? ( Sub-sub-controller ) |
[eluser]Q-efx[/eluser]
Hello, Iam new to CI i know that this is possible: domain.com/group/news/:action but how could i archive this: domain.de/group/news/comments/:action ? thx for help
[eluser]jedd[/eluser]
Is this what you're after : [url="http://ellislab.com/codeigniter/user-guide/general/controllers.html#subfolders"]http://ellislab.com/codeigniter/user-guide/general/controllers.html#subfolders[/url]
[eluser]Q-efx[/eluser]
[quote author="jedd" date="1235952422"]Is this what you're after : [url="http://ellislab.com/codeigniter/user-guide/general/controllers.html#subfolders"]http://ellislab.com/codeigniter/user-guide/general/controllers.html#subfolders[/url][/quote] Yes with one sub-folder it works, but how i could use this: controller/group/news/comments and a url like: www.domain.com/group/news/comment/:action this dont work
[eluser]jedd[/eluser]
[quote author="Q-efx" date="1235952772"] Yes with one sub-folder it works, but how i could use this: controller/group/news/comments and a url like: www.domain.com/group/news/comment [/quote] Ahh .. sounds like you want this: [url="http://ellislab.com/codeigniter/user-guide/general/routing.html"]http://ellislab.com/codeigniter/user-guide/general/routing.html[/url] Although you probably don't - you just think you do
[eluser]davidbehler[/eluser]
I've never used subfolders, but I think it should look like this: controller/group/news/comment.php And in the comment.php controller you have the action function.
[eluser]pistolPete[/eluser]
Have a look at: - Controllers in Unlimited Nested Folders - Are Multiple Sub-folders for Controllers Allowed?
[eluser]Q-efx[/eluser]
I dont get it, with which route could i use the controller/group/news/comments.php file?
[eluser]Q-efx[/eluser]
Ok dont get it which code i have to change or add and where?
[eluser]majidmx[/eluser]
I think you're problem can be solved with nested folders for controllers and you don't need to touch the routes. If I'm getting it wrong, please add more explanation to what you exactly want to do.
[eluser]Pascal Kriete[/eluser]
I agree with what has been said, but I think a controller for comments might be a little too much separation. Why not make it part of the news controller? Then just do what feels right: Create the controller file: /controllers/group/news.php Add a comment function - parameters (:action) are passed in automatically: Code: class News extends Controller { Hope that helps. Welcome to CodeIgniter. |
Welcome Guest, Not a member yet? Register Sign In |