Hi,
In CakePHP, the views don't display directly, you need to render them using
actions of controllers. From your description, it seems that you need to
redirect to /posts/index page, so use
$this->redirect(array('controller' => 'posts', 'action' => 'index'));
to go to that page.
Hope this helps.
Amit Badkas
PHP Applications for E-Biz: http://www.sanisoft.com
On Wed, Dec 29, 2010 at 10:28 AM, John Maxim <[email protected]> wrote:
> Users_controllers.php:
> ~~~~
>
> var $name = 'Users';
>
> /*some codes in between*/
>
> function login()
> {
> if(!empty($this->data))
> {
> // If the username/password match
> if($this->Auth->login($this->data))
> {
> $this->redirect(array('action' => 'index'), null,
> true);
> } else {
> $this->User->invalidate('username', 'Username and password
> combination is incorrect!');
> }
> }
> }
>
> -----------------
> Hi,
>
> After successful login, I want it to redirect to app/views/posts/
> index.ctp
>
> Originally, the redirect code is like this:
> (1)
> ~~
> $this->redirect('/');
> ~~
> I changed to:
> (2)
> ~~
> $this->redirect(array('action' => 'index'), null, true);
> ~~
> (3)
> ~~
> $this->redirect(array('action' => 'views/posts/index'), null, true);
> ~~
>
> All failed to redirect to *app/views/posts/index.ctp
> ~~
> It consistently redirected me to my App/index.ctp which displays all
> my cakephp versions stuff (mod rewrite...etc the green page),
> regardless of the 3 redirect methods used above.
>
> Is it something wrong with my Login() function instead ??
>
>
>
> Thanks,
>
> Maxim J.
>
> 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]<cake-php%[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