Forward to "internal" controllers

Hello,

Is it possible to do something like this:

PageController.php:




public function actionPage(){

    if (isset($_POST['LoginModel'])) {

        $this->forward('/page/Account/Login', false);

    }

}



AccountController.php:




public function actionLogin(){

    //login code

}



But without having the AccountController methods (/page/Account/Login) directly web accessible? I.e. so the actions work but are internal to Yii only.

Thanks

You could configure urlManager to handle page/page to account/login

Hmm not sure that will work. I want to continue running additional code in actionPage() after actionLogin() has run.

yes you can, the forward function will allow you process another controller to be able work inside that action.

example:




public function actionTest()

        {           

            echo 'Test';

        }

        

        public function actionTest2()

        {

            echo 'A<BR>';

            $this->forward('site/test', false);

            echo '<br>B';

        }



this will get result: