Hi David,

Thank you. That was very helpful.

I added the following route:

Router::connect('/countries/:country_id/cities/*', array('controller'
=> 'cities'));

This route points to the following function inside the "cities"
controller:

        function index() {
                $this->City->recursive = 0;
                $this->set('cities', $this->paginate());
        }

I was thinking about passing the "country_id" to the "paginate()"
function as its criteria.
Do you know of a better way to filter the data?

Cheers,
Mike

On Oct 15, 3:07 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> http://book.cakephp.org/view/542/Defining-Routes
>
> Your route would look something like:
>
> Router::connect('/countries/:country_id/cities/*', array('controller'  
> => 'cities', 'action' => 'someCityAction'));
>
> The 'country_id' will be available in $this->params in the controller.
>
> On 15 Oct 2008, at 08:31, machuidel wrote:
>
>
>
> > Hello,
>
> > How can I map a controller to an URL like "/countries/12/cities/" such
> > that the index of cities will be filtered by the specified country? I
> > would like that URL to dispatch the "city" controller (not the
> > "country" controller) with the specified country as its argument.
> > Something like:
>
> > class CityController extends AppController {
>
> >  ...
>
> >  function index_country ($country_id) {
> >     // Index of cities filtered by specified country
> >  }
>
> >  ...
>
> > }
>
> > Could not find any example of someone doing this in Cakephp.
>
> > Cheers,
> > Mike
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to