Zend view and layout
How to zend view/layout?
- Default
$zf enable layout == application/layouts/scripts/layout.phtmldefault page == application/views/scripts/index/index.phtml - Mannual* make directory under > application/views/scripts/folder/file.phtml
* make controller under > application/controllers/FolderController.php
FolderController.php > indexAction(){}
Practical: | Steps: | Results: (whats happening?) |
#
# Edit: application/views/scripts/index/index.phtml # <p> </p> |
a. Default body content fix | Nothing just prepared a default body. |
#
# Edit: application/layouts/scripts/layout.phtml # — Header (application/layouts/scripts/layout.phtml)– <?php echo $this->layout()->content; ?> — Footer (application/layouts/scripts/layout.phtml)– |
b. Default layout fix | By Visiting: http://localhost/myzf/public/
a. layout.phtml loaded |
#
# Make & Edit: # application/views/scripts/shamun/index.phtml # <p> [[[ shamun mannual – i am from application/views/scripts/shamun/index.phtml ]]] </p> # # Make & Edit: # application/controllers/ShamunController.php # class ShamunController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ } public function indexAction() { // action body echo ‘<p style=”color:red;”>[[[shamun – i am from application/controllers/ShamunController.php]]]</p>’; } } |
c. Make mannual views or pages or nice looking url! | By visiting: http://localhost/myzf/public/shamun/
a. layout.phtml loaded b. controller action is triggered c. it look the page contents d. it apply function rest actions |