Friday, February 21, 2014

Yii calling controller from another controller example


   

  public function actionTest()
            {
                Yii::import('application.controllers.SiteController');
                $obj = new SiteController(); 
                $obj->actionSitetest();

            }

 from above example actionTest call a function named Sitetest from  SiteController.

 * first line imports the SiteController.php file,

 * next line instantiate the SiteController class.

 * third line call a function named Sitetest that is defined in the SiteController

No comments:

Post a Comment