Friday, 15 May 2015

Zend Framework - multiple modules, one layout -



Zend Framework - multiple modules, one layout -

i have zend application next structure:

application configs application.ini modules api controllers bootstrap.php default controllers indexcontroller.php models views scripts index index.phtml layouts layout.phtml bootstrap.php

my application/configs/application.ini looks this:

phpsettings.display_startup_errors = 0 phpsettings.display_errors = 0 includepaths.library = application_path "/../library" bootstrap.path = application_path "/bootstrap.php" bootstrap.class = "bootstrap" appnamespace = "application" resources.frontcontroller.controllerdirectory = application_path "/controllers" resources.frontcontroller.params.displayexceptions = 0 resources.db.adapter = "pdo_sqlite" resources.db.params.dbname = application_path "/../data/db/test.sqlite3" resources.modules = "" resources.frontcontroller.params.prefixdefaultmodule = "1" resources.frontcontroller.moduledirectory = application_path "/modules" resources.layout.layoutpath = application_path "/modules/default/views/layout/"

my problem cannot utilize layout no matter do. if go http://test.app/index/index, can see output of view script, not layout.

i see specify layout path never actual layout file use. assuming layout named layout.phtml add together app's ini.

resources.layout.layout = "layout"

you can override on per action/controller level if ever need utilize more 1 layout. in controller can reach layout via $this->_helper->layout() have methods such as: setlayoutpath(), setlayout(), disablelayout()

reference: http://framework.zend.com/manual/1.12/en/learning.layout.usage.html

zend-framework module zend-layout

No comments:

Post a Comment