Welcome Guest, Not a member yet? Register   Sign In
Calling actions in another controller?
#1

[eluser]oscaralexander[/eluser]
I'm starting a new CI project this evening and I want to get it right from the ground up. Now there's one particular issue I'm wondering about and would like to know what the guru's approach is to this.

I have this website that will feature the 10 best places in different cities accross the world. The URL structure will be like this (for the sake of readability, guessability and SEO):

domain.com/united-kingdom < list of cities + 10 best places in the UK
domain.com/united-kingdom/london < list of boroughs + 10 best places in London
domain.com/united-kingdom/london/shoreditch < 10 best places in Shoreditch, London

Since *every* bit after domain.com is variable (except for some basic stuff like /contact, /about etc.) I decided to subclass the Router class and make every 404 point to the index action of my default controller (Core::index), where I perform further 404 checking/handling.

Still with me? Smile Now, since the above approach would be an awful lot of code for a single controller, I was wondering if I could delegate to other, specialized actions in other controllers. For instance, if a visitor requests domain.com/united-kingdom/london I would like to:

1. Verify if this record exists in the Core::index action
2. Delegate to a specialized controller, i.e. City::place

Is this at all possible? Thanks guys!


Messages In This Thread
Calling actions in another controller? - by El Forum - 03-16-2010, 03:13 PM
Calling actions in another controller? - by El Forum - 03-16-2010, 09:44 PM
Calling actions in another controller? - by El Forum - 03-17-2010, 01:54 AM
Calling actions in another controller? - by El Forum - 03-17-2010, 07:24 AM
Calling actions in another controller? - by El Forum - 03-17-2010, 11:16 AM
Calling actions in another controller? - by El Forum - 03-17-2010, 11:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB