Could do something like this:

// routes.php

Router::connect('/my/profile', array('controller' => 'users', 'action'
=> 'cookieProfile'));


// UsersController

function cookieProfile(){
        $username = $this->Cookie->read('username');
        if ($username){
                $this->redirect('/users/profile/'., null, true);
        } else {
                // show error of some sort & redirect?
        }
}

function profile($username){
        $user = $this->User->findByUsername($username);
        // blah....
}

On Jan 9, 12:33 am, miikka <[EMAIL PROTECTED]> wrote:
> I'm bit confused how to implement this. For example:
>
> Lets say I'm logged in as User1. Username is stored into the cookie.
> I would like to reroute /my/profile as /users/profile/User1. How can I
> use cookie data for the route? In other words I would like to create a
> dynamic route.
>
> btw. is this only possible with cake 1.2.x.x or also with 1.8.x.x->
>
> On Jan 5, 4:47 am, "Christian Winther" <[EMAIL PROTECTED]> wrote:
>
> > Use the router make sure both urls hit the same controller action :)
>
> > -----Original Message-----
> > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
> > miikka
> > Sent: 5. januar 2008 02:09
> > To: Cake PHP
> > Subject: How to set action to the another controller
>
> > Hi,
>
> > I have CakePHP app where user can go to the url /my/profile when he/
> > she is logged in. This would have the same affect than going to the
> > page /users/profile/[currently_logged_in_username]. How could I render
> > this as /users/profile/[currently_logged_in_username]. Currently
> > CakePHP 1.2.x.x has method setAction but is only for inside controller
> > "redirecting".
>
> > Any help, pointers would be appreciated.
>
> > Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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