[心得] Zend 學習筆記(3) Layout篇

看板PHP作者 (amos)時間15年前 (2010/03/17 23:23), 編輯推噓2(204)
留言6則, 3人參與, 最新討論串1/1
Zend_Layout使用的是Two Step View pattem 小弟在此直接簡單的時實做 首先我們開啟cmd 到我們的專案下 輸入zf --help 可以看到Layout下有個zf enable layout 我們接著就輸入zf enable layout 當你看到 Layouts have been enabled, and a default layout created at.... 喔耶表示成功了 這時我們可以到: |-- application | |-- configs | | `-- application.ini (打開這個) 可以看到下面這段 resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" 另外在下面加入 resources.view[] = (此初始值要提供給下列的method使用) 同時也會產生 aplication/layouts/scripts/layout.phtml 我們現在要宣告XHTML DocType打開pplication/Bootstrap.php 我們現再寫一個method去讀取view proterted function _initDoctype(){ $this->bootstrap('view'); $view=$this->getResource('view'); $view->doctype('XHTML1_STRICT'); } 我們現在到application/layouts/scripts/layout.phtml 打開layout.phtml 加上<?php echo $this->doctype() ?> 有設定virtual host 的話 輸入http://127.0.0.1 沒有的話後面再加上專案名稱/public 然後檢視原始碼就可以看到我們宣告的XHTML DocType 小弟才剛開始學習對於API與元件還不熟悉 也希望各位前輩能給予指導與切磋 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.45.213.129 ※ 編輯: amos6064 來自: 114.45.213.129 (03/17 23:31)

03/18 17:13, , 1F
建議可以來點圖 讓我們增加興趣
03/18 17:13, 1F

03/18 17:14, , 2F
大家比較會有回饋
03/18 17:14, 2F

03/18 20:22, , 3F
ㄎㄎ要圖是結果嗎?ok阿謝謝回應~~
03/18 20:22, 3F

03/18 20:23, , 4F
我先整理一下Controller還有Model
03/18 20:23, 4F

03/18 20:24, , 5F
這個整理完後會在調整一下心得分享
03/18 20:24, 5F

03/19 11:48, , 6F
感謝分享
03/19 11:48, 6F
文章代碼(AID): #1BeFFRH- (PHP)
文章代碼(AID): #1BeFFRH- (PHP)