frontend & backend : view problem

base on this article : http://www.yiiframework.com/wiki/63/organize-directories-for-applications-with-front-end-and-back-end-using-webapplicationend-behavior/

the application is multi-theme. before I use frontend &backend, I put the view files in “protected/views/tx/view_files.php”. so, in one application, I can have 2 or moretheme with only one “view files” located in protected.

after I use frontend & backend base on the above article,I must copy the “view files” in protected into every theme, or the contollerwill never find the “view files” if it still located in protected.

my question : is there any way I retain the “view files”inside protected?

I guess the problem is in the “changeModulePaths($event)”inside “WebApplicationEndBehavior” file. if I change to “$event->sender->viewPath.= DIRECTORY_SEPARATOR;”, the “view files” will point to protected location, onlythe web does not load correctly.

if I change to “$event->sender->viewPath =$event->sender->theme->basePath.DIRECTORY_SEPARATOR.‘views’.DIRECTORY_SEPARATOR.$this->_endName;”the web will load correctly only if I copy every “view files” from protectedinto theme view. if the “view files” are not located in theme, the web willreturn error.

[size=2]WebApplicationEndBehavior.php[/size]

[size=2]


[/size]


class WebApplicationEndBehavior extends CBehavior


{


   ...


	// onModuleCreateevent handler.


	// A sender musthave controllerPath and viewPath properties.


	protected functionchangeModulePaths($event)


	{


       $event->sender->controllerPath .=DIRECTORY_SEPARATOR.$this->_endName;


       $event->sender->viewPath .=DIRECTORY_SEPARATOR.$this->_endName;


    	


    	if($event->sender->theme !== null)


        	/*


         	* VIEWFILES   : LOCATED IN PROTECTED


         	*PROBLEM  	: WEB STYLE DOES NOT LOADCORRECTLY, BUT DATA


         	*              	LOAD CORRECTLY


         	* CHROMEDEBUG : Failed to load resource: net::ERR_CACHE_MISS


         	*/


           //$event->sender->viewPath .= DIRECTORY_SEPARATOR;


        	


        	/*


         	* VIEWFILES   : LOCATED IN THEME


         	*PROBLEM  	: INEFFICIENT. THE VIEWFILES SHOULD ONLY EXIST


         	*              	IN ONE LOCATION.


         	*/       	


           $event->sender->viewPath =$event->sender->theme->basePath.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.$this->_endName;


	}





}


[size=2]

[/size]

I also face same issue is there any way like try and catch ?

if view file does not exist in theme directory then it should automatically use default protected view file…

please advice.