the pass key is not bi-directional.  It only turns routed params into
passed params, when incoming urls are parsed.  It doesn't do anything
for reverse routes.  You would need to key your $geoCountry,
$geoRegion, and $geoSuburb values with the matching route keys for the
routes to reverse route correctly.

Unfortunately its almost impossible to map passed args back into
routed ones, without what I would think is expensive logic to traverse
the routes collection several times until a match is found.

-Mark

On Dec 10, 9:00 am, meekamoo <[email protected]> wrote:
> Struggling with reverse routing here.
>
> I have 3 routes set up:
>
>   Router::connect('/:country/listing/:countryname/',
>                   array('controller' => 'properties', 'action' =>
> 'newindex'),
>                   array('country' => '[a-z]{2}', 'pass' =>
> array('countryname')));
>
>   Router::connect('/:country/listing/:countryname/:regionname/',
>                   array('controller' => 'properties', 'action' =>
> 'newindex'),
>                   array('country' => '[a-z]{2}', 'pass' =>
> array('countryname', 'regionname')));
>
>   Router::connect('/:country/
> listing/:countryname/:regionname/:suburbname/',
>                   array('controller' => 'properties', 'action' =>
> 'newindex'),
>                   array('country' => '[a-z]{2}', 'pass' =>
> array('countryname', 'regionname', 'suburbname')));
>
> They are functioning correctly. I can access it via the routed url and
> it passes the values correctly.
>
> The problem is with reverse routing,
>
> echo $html->url(array('controller' => 'properties', 'action' =>
> 'newindex', $geoCountry, $geoRegion, $geoSuburb));
>
> Prints out /za/properties/newindex/south-africa/western-cape/cape-town
>
> Whereas it should use the routing pattern and create /za/listing/south-
> africa/western-cape/cape-town (ignore the country in the url, that is
> added in appcontroller::redirect and apphelper::url overrides)
>
> I'm pretty stumped with this one!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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