Home php教程 php手册 zend Framework中的Layout(模块化得布局)详解

zend Framework中的Layout(模块化得布局)详解

Jun 06, 2016 pm 08:29 PM

本篇文章是对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() ?>



Zend Framework Quickstart Application
headLink()->appendStylesheet('/css/global.css') ?>




ZF Quickstart Application



layout()->content ?>



然后查看页面内容,如果有一个横条,香港服务器,则表示成功,该条会出现在所有页面中!
,香港空间
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)