本篇文章是对zend Framework中的Layout(模块化得布局)进行了详细的分析介绍,需要的朋友参考下
1.首先修改application配置文件
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
指定布局文件的位置
2.然后最简单的方法就是修改引导文件 bootstrap.php文件添加一个自动执行的方法:
protected function _initDoctype() { }
3.给我们的配置文中加入一个
resources.view[] =
这里我们给视图赋值,美国空间,虽然他只是一个空值~
4.在我们的引导文件中加入
复制代码 代码如下:
protected function _initDoctype()
{
$this->bootstrap('view');//开启视图
$view = $this->getResource('view');//获取文档的试图.定义于主配置中
$view->doctype('XHTML1_STRICT'); //设置文档类型
}
5.最后让我们增加一个Layout.HTML文件于application/layouts/scripts/下即可
内容为:
复制代码 代码如下:
doctype() ?>
headLink()->appendStylesheet('/css/global.css') ?>
layout()->content ?>
然后查看页面内容,如果有一个横条,香港服务器,则表示成功,该条会出现在所有页面中!
,香港空间

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 English version
Recommended: Win version, supports code prompts!
