Welcome Guest, Not a member yet? Register   Sign In
Is this possible? ( Sub-sub-controller )
#1

[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 Wink
#2

[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]
#3

[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 Wink
#4

[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 Wink
#5

[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.
#6

[eluser]pistolPete[/eluser]
Have a look at:

- Controllers in Unlimited Nested Folders
- Are Multiple Sub-folders for Controllers Allowed?
#7

[eluser]Q-efx[/eluser]
I dont get it,

with which route could i use the controller/group/news/comments.php file?
#8

[eluser]Q-efx[/eluser]
Ok dont get it which code i have to change or add and where?
#9

[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.
#10

[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 {

// .... the usual stuff ...

    function comments($id = FALSE)
    {
        if ($id === FALSE)
        {
            die('no comment id!!');  // or something like that
        }

        // query the db, check for results, and show it or toss an error
    }
}

Hope that helps. Welcome to CodeIgniter.




Theme © iAndrew 2016 - Forum software by © MyBB