Here's a solution that works:
foreach (Configure::read('Routing.prefixes') as $key=>$prefix) {
Router::connect("/{$prefix}/:controller/add", array('action' => 'edit',
'prefix' => $prefix, $prefix => true, 'originalAction' => 'add'));
}
Jeremy Burns
Class Outfit
[email protected]
(t) +44 (0) 208 123 3822
(m) +44 (0) 7973 481949
Skype: jeremy_burns
http://www.classoutfit.com
On 6 Dec 2010, at 15:25, Tilen Majerle wrote:
> make custom router class
> --
> Tilen Majerle
> http://majerle.eu
>
>
>
> 2010/12/6 Tilen Majerle <[email protected]>
> but u're not able to do this like that...
> --
> Tilen Majerle
> http://majerle.eu
>
>
>
> 2010/12/6 Jeremy Burns | Class Outfit <[email protected]>
>
> That defeats the point though. I could just as easily put 'admin' into the
> route. I want to do prefix routing, which means being dynamic - in other
> words, handle any prefix (just as :controller would handle any controller).
>
> Jeremy Burns
> Class Outfit
>
> [email protected]
> http://www.classoutfit.com
>
> On 6 Dec 2010, at 15:19, Tilen Majerle wrote:
>
>> yes, u need to define $prefix before call Router::connect :D
>>
>>
>> something like that:
>>
>>
>> {{{
>>
>> $prefix = "admin";
>>
>> Router::connect("/{$prefix}/:controller/:action/*", array('prefix' =>
>> $prefix, $prefix => true));
>>
>>
>> }}}
>> --
>> Tilen Majerle
>> http://majerle.eu
>>
>>
>>
>> 2010/12/6 Jeremy Burns <[email protected]>
>> According to the book (http://book.cakephp.org/view/950/Prefix-
>> Routing) it appears that this ought to work:
>>
>> Router::connect("/{$prefix}/:controller/:action/*", array('prefix' =>
>> $prefix, $prefix => true));
>>
>> When I use it, however, I get:
>>
>> Undefined variable: prefix [APP/config/routes.php, line xx]
>>
>> AmI doing something wrong or making the wrong assumption? ow can I get
>> this to work?
>>
>> 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
>>
>>
>> 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
>
>
> 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
>
>
>
> 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
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