2010-01-13 4 views

답변

2

은 다음보십시오.

HTH.

+0

도움이 되었어요! 굉장해! 감사. – Volomike

+0

기쁘다. 당신은 환영합니다. – rvdavid

+0

내 잘못입니다. 나는 그가이 부분을하는 방법을 알고 있다고 생각했다. – Gordon

1

ZF Manual for Zend_View를 참조하여 부트 스트랩이 배치 :이

base/path/ 
    helpers/ 
    filters/ 
    scripts/ 

참조 : 선택한 basePath이의 디렉토리 구조를 가정합니다

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap 
{ 
    protected function _initView() 
    { 
     $view = new Zend_View(); 
     $view->setScriptPath('/some/new/path'); // overwrite any paths 
     $view->addScriptPath('/some/other/path'); // adds additional paths 
     $view->setEncoding('UTF-8'); 
     $view->doctype('XHTML1_STRICT'); 
     $view->headMeta()->appendHttpEquiv(
      'Content-Type', 'text/html;charset=utf-8' 
     ); 
     $viewRenderer = 
     Zend_Controller_Action_HelperBroker::getStaticHelper(
      'ViewRenderer' 
     ); 
     $viewRenderer->setView($view); 
     return $view; 
    } 
} 

또는 configure your Ini for use with Zend_Application_Resource_View

resources.view.encoding = "UTF-8" 
resources.view.basePath = APPLICATION_PATH "/views/scripts" 
... 

tutorial by Padraic Brady. 이전 대답은 당신이보기 렌더러에 추가 스크립트 경로를 가지고 구성한보기를 설정 한 부분이 누락되어

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap 
{ 

// ... 

    protected function _initView() 
    { 
     // Initialise the view 
     $view = new Zend_View(); 
     $view->addScriptPath(APPLICATION_PATH.'/views'); 

     // set the configured view as the view to be used by the view renderer. 
     $renderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); 
     $renderer->setView($view); 

     return $view; 
    } 

// ... 

} 

:

+0

프로젝트에서이 작업을 전역 적으로 수행하여 컨트롤러의 각 클래스 메소드에서이 작업을 계속 추가 할 필요가 없습니까? – Volomike

+0

예. Ini에 배치하기위한 추가 정보보기 – Gordon

+0

"/ views/scripts"대신 INI 제안을 "/ views"로 설정 한 다음 configs/application.ini에서 "production"아래에 시도했습니다. 그것은 작동하지 않았고 "스크립트"를 찾는 데 오류가있었습니다. – Volomike

관련 문제