欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

zend Framework中的Layout(模塊化得布局)詳解

 更新時(shí)間:2013年06月28日 15:56:19   作者:  
本篇文章是對(duì)zend Framework中的Layout(模塊化得布局)進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下

1.首先修改application配置文件
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
指定布局文件的位置

2.然后最簡(jiǎn)單的方法就是修改引導(dǎo)文件 bootstrap.php文件添加一個(gè)自動(dòng)執(zhí)行的方法:
protected function _initDoctype()    {    }

3.給我們的配置文中加入一個(gè)
resources.view[] =
這里我們給視圖賦值,雖然他只是一個(gè)空值~

4.在我們的引導(dǎo)文件中加入

復(fù)制代碼 代碼如下:

 protected function _initDoctype()
    {
        $this->bootstrap('view');//開(kāi)啟視圖
        $view = $this->getResource('view');//獲取文檔的試圖.定義于主配置中
        $view->doctype('XHTML1_STRICT'); //設(shè)置文檔類(lèi)型
    }

5.最后讓我們?cè)黾右粋€(gè)Layout.HTML文件于application/layouts/scripts/下即可
內(nèi)容為:
復(fù)制代碼 代碼如下:

<?php echo $this->doctype() ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Zend Framework Quickstart Application</title>
<?php echo $this->headLink()->appendStylesheet('/css/global.css') ?>
</head>
<body>
<div id="header" style="background-color: #EEEEEE; height: 30px;">
   <div id="header-logo" style="float: left" mce_style="float: left">
        <b>ZF Quickstart Application</b>
    </div>
    <div id="header-navigation" style="float: left" mce_style="float: left">
       <a href="<?php echo $this->url(
            array('controller'=>'guestbook'),
            'default',
            true) ?>">Guestbook</a>
    </div>
</div>
<?php echo $this->layout()->content ?>
</body>
</html>

然后查看頁(yè)面內(nèi)容,如果有一個(gè)橫條,則表示成功,該條會(huì)出現(xiàn)在所有頁(yè)面中!

相關(guān)文章

最新評(píng)論