Can We Create Sub Folder For Controller And View ?

Dear all,

in view of yii,we create folder of view by controller name.However, I want to create 2 sites of view: admin and user, is there any ways can do like this:

controller name:ServicesController

for the view, we usually create


,but can I create view like this:



Check the URL Management section in the Guide..

You can use modules or override the getViewPath() method of your basecontroller (=Controller.php)

class Controller extends CController {

   public $viewSubDir;

        public function getViewPath()



                 return parent::getViewPath()






		return $module->getViewPath().DIRECTORY_SEPARATOR.$this->viewSubDir.DIRECTORY_SEPARATOR.$this->getId();





In your ServiceController

class ServiceController extends Controller 


   public $viewSubDir = 'users';



Or you can set the viewSubdir in the actions ‘on the fly’ before calling render.

  public function actionXY() 



      $this->viewSubDir = 'admin';



Use url manager and module generator