ZF를 사용하여 고객 포털 응용 프로그램을 만들고 있습니다. 그리고 포털은 다른 회사 브랜드에서 작동해야합니다. 그래서 같은 백엔드 코드/컨트롤러/etc를 모두 사용해야하지만, 호스트 이름을 기반으로 뷰 디렉토리를 동적으로 변경해야합니다.동적으로보기 디렉토리 설정
/application/views/scripts/brand1/
/application/views/scripts/brand1/index/index.phtml
/application/views/scripts/brand1/error/error.phtml
/application/views/scripts/brand2/
/application/views/scripts/brand2/index/index.phtml
/application/views/scripts/brand2/error/error.phtml
/application/views/scripts/brand3/
/application/views/scripts/brand3/index/index.phtml
/application/views/scripts/brand3/error/error.phtml
and so on.
나는이 그것을 실행하지만 너무
protected function _initView()
{
$view = new Zend_View();
$view->doctype('XHTML1_STRICT');
$view->env = APPLICATION_ENV;
$view->addScriptPath(APPLICATION_PATH . '/views/scripts/brand1');
$view->addHelperPath(APPLICATION_PATH . '/views/helpers');
...
}
처럼 bootstrap.php에 addScriptPath() 함수를 사용하고 있습니다 :
는는 지금 내보기 디렉토리 구조는 다음과 같이 보입니다 /views/scripts/brand1/(action).phtml을 사용하여 모든보기를 찾고 있습니다. 올바른보기 /view/scripts/brand1/(controller).phtml을 사용하여보기를 찾는 대신
tl; dr은 동적으로 뷰 디렉토리를 선택하고 기본 /views/scripts/(controller)/(action).phtml 동작처럼 작동하게 할 수 있습니까?