私は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のように動作させることができますか?