'Nested' actions in controllers (e.g. /action/sub-action)
Permalink
Hi all
I'm putting together a controller for a single page which passes a different page list to the view depending on the chosen action. At the moment i have these actions:
/scotland
/united-kingdom
/eu
but I'd like to create these too:
/scotland/all
/united-kingdom/all
/eu/all
How is this done in one single controller? Do I need to create a folder structure with further controllers, or is it possible to do this from a single controller for the single page?
I can achieve it using GET variables (e.g. url.com/scotland?v=all) but it's not particularly pretty :)
I'm putting together a controller for a single page which passes a different page list to the view depending on the chosen action. At the moment i have these actions:
/scotland
/united-kingdom
/eu
but I'd like to create these too:
/scotland/all
/united-kingdom/all
/eu/all
How is this done in one single controller? Do I need to create a folder structure with further controllers, or is it possible to do this from a single controller for the single page?
I can achieve it using GET variables (e.g. url.com/scotland?v=all) but it's not particularly pretty :)
Ahh I see, does this mean the controller would look like this:
Is it that simple?
On 28 June 2012 17:40, concrete5 Community <discussions@concretecms.com>wrote:
// For /scotland public function scotland(all = null) { ... } //For /scotland/all public function scotland(all = 'all') { ... }
Is it that simple?
On 28 June 2012 17:40, concrete5 Community <discussions@concretecms.com>wrote:
Correct
Sent from my phone
On Jun 28, 2012 1:10 PM, "concrete5 Community" <discussions@concretecms.com>
wrote:
Sent from my phone
On Jun 28, 2012 1:10 PM, "concrete5 Community" <discussions@concretecms.com>
wrote:
public function view($area = null, $all = false) { }
You can simply add another param to the action, you could also do it like
public function eu($all = false) { }
the paths yourpage/scotland will go to the action with all=null, and yourpage/scotland/all will go to the action with all='all' as a parameter.