반응형
Zend Framework에서 레이아웃 파일을 전환하는 방법은 무엇입니까?
단순한 한 줄짜리라고 확신 할 수 없습니다.
특정 작업에 다른 레이아웃 파일을 어떻게 사용할 수 있습니까?
업데이트 : 이것은 나를 위해 일했습니다, 감사합니다!
// Within controller
$this->_helper->_layout->setLayout('other-layout') //other-layout.phtml
//Within view script
<?php $this->layout()->setLayout('other-layout'); ?>
컨트롤러 내부에서 :
$this->_helper->layout->setLayout('/path/to/your/layout_script');
( 이 문서
를 통해 )편집 : 경로는 디렉토리가 무엇이든 관련이 있음을 참조합니다 (기본적으로 application/layouts/scripts/
)
다음과 같이 사용할 수도 있습니다.
// Within controller
Zend_Layout::getMvcInstance()->setLayout('layout_name');
//Within view script
<?php $this->layout()->setLayout('layout_name'); ?>
레이아웃은 / layouts / scripts / 폴더에 있어야합니다. 명명되지 않은 경로도 지정해야합니다. .phtml을 필요로하는 레이아웃의 이름 만
참고 URL : https://stackoverflow.com/questions/1615956/how-to-switch-layout-files-in-zend-framework
반응형
'ProgramingTip' 카테고리의 다른 글
JavaScript에서 요청 헤더 설정 (0) | 2020.12.05 |
---|---|
Java 날짜 API (java.util.Date, .Calendar)가 왜 그렇게 엉망입니까? (0) | 2020.12.05 |
Facebook은 브라우저 주소 표시 줄에서 페이지의 소스 URL을 어떻게 다시 작성합니까? (0) | 2020.12.05 |
NSManagedObjectContext를 생성 한 단일 또는 큐가 소유하고 Apple이 말하는 것은 무엇을 의미합니까? (0) | 2020.12.05 |
일대일 최대 수용 모드 : 전체 객체를 가져 오지 않고 getId () (0) | 2020.12.04 |