What you need is to read the prefix routing on the cake cookbook:
http://book.cakephp.org/view/945/Routes-Configuration#Prefix-Routing-950
Anyway, you only have to add these lines at the end of your routes.php:
Router::connect('/m/:controller/:action/*', array('prefix' => null));
Router::connect('/m/:controller/*', array('action' => 'index', 'prefix' =>
null));
Router::connect('/m/', array([YOUR MOBILE WEBROOT HERE]));
This will redirect all /m/* calls to your original actions through a faux
prefix (m).
Cheers,
- Johan
On Sun, Jul 24, 2011 at 5:31 AM, leugim s <[email protected]> wrote:
> respuesta
>
> first my english isn't good.
>
> thanks for your reply.nurvzy
>
> yes i did that
>
> if($this->RequestHandler->isMobile()){
> $this->layout = 'mobile';
> }
> and works very well, when i connect from my iphone the aplicattion change
> the layout, and i have 2 links in footer page to change between mobile and
> standar version.evereything OK
>
> my goal is avoid duplicate content ,so i need to add te /m/ tag to URL
>
> Alejandro thanks ur reply too.
>
> yes I tried something with routes,, and I think thats the way to solve my
> problem ,, but i cant find something to help me.
>
> if you can help me.. te lo agradeceria
>
> thanks
> *
> *
> *yes I tried something with routes,, and I think thats the way to solve
> my problem ,, but i cant find something to help me.*
> *
> *
> *if you can help me.. te lo agradeceria*
>
> thanks
>
>
>
>
>
>
>
> 2011/7/23 nurvzy <[email protected]>
>
>> Why do that at all? If you use the RequestHandler component you can
>> detect a mobile browser via their USER_AGENT. Then, just switch the
>> layout from your default layout to one specifically designed for
>> mobile.
>>
>>
>> http://api13.cakephp.org/class/request-handler-component#method-RequestHandlerComponentisMobile
>>
>> Example:
>> if($this->RequestHandler->isMobile()){
>> $this->layout = 'mobile';
>> }
>>
>> Using the same logic you could also use themes for even more control
>> over how each specific view shows up in mobile vs normal.
>>
>> Using Themes
>> http://book.cakephp.org/view/1093/Themes
>>
>> Hope that helps,
>> Nick
>>
>> On Jul 20, 11:50 am, m16u31 <[email protected]> wrote:
>> > Hi im creating an apliocacion. and I need a mobile version, the mobile
>> > version is ok, works fine.
>> > but.
>> >
>> > i need and differen url for the mobile version. something like this:
>> >
>> > wwww.example.com/m/controller/action/var With /m/
>> > after the domain
>> >
>> > and normal version
>> > wwww.example.com/controller/action/var
>> >
>> > how can i do that?
>> >
>> > i tried to do something like internationalization. and
>> > with $this-params
>> >
>> > but it doesn't work
>> >
>> > thank and sorry for my english
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> To unsubscribe from this group, send email to
>> [email protected] For more options, visit this group
>> at http://groups.google.com/group/cake-php
>>
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
> at http://groups.google.com/group/cake-php
>
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php