YII 实现布局
布局文件:
<div>我是头部</div>
<!--展示首页、登录、注冊等代码信息-->
<!--$content代表我们已经提取出来的首页、登录、注冊等页面信息(没有头部和脚部)-->
<? php echo $content; ?> <div>我是尾部</div>
位置:
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYnV5aW5nZmVpODg4OA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
布局文件已经实现出来,以下我们须要使用这个布局文件
我们系统默认的布局文件是colum1.php
使用布局文件:
布局文件详细与什么有关系:
控制器渲染视图renderPartial()此方法不会渲染布局
render()这种方法会渲染布局。
如今我们布局已经做好了:
1. 制作布局文件layouts/文件名称字,使用$content代表普遍模板内容。
2. 设置布局文件,在父类控制器里边public $layout = "//layouts/shop";
3. 调用布局文件,在控制器方法里边用法render()就会调用布局文件。
还有一种通过frameset来实现:
<!--通过html的frameset标签集合头部、左側、右側-->
<!doctype html public "-//w3c//dtd xhtml 1.0 frameset//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-frameset.dtd">
<html>
<head>
<meta http-equiv=content-type content="text/html; charset=utf-8" />
<meta http-equiv=pragma content=no-cache />
<meta http-equiv=cache-control content=no-cache />
<meta http-equiv=expires content=-1000 /> <title>管理中心 v1.0</title>
</head>
<frameset border=0 framespacing=0 rows="60, *" frameborder=0>
<frame name="head" src="./index.php?r=houtai/index/head" frameborder=0 noresize scrolling=no>
<frameset cols="170, *">
<frame name="left" src="./index.php?r=houtai/index/left" frameborder=0 noresize />
<frame name="right" src="./index.php?r=houtai/index/right" frameborder=0 noresize scrolling=yes />
</frameset>
</frameset>
<noframes>
</noframes>
</html>
YII 实现布局的更多相关文章
- yii控制布局方式
1:在控制器内成员变量设置 public $layout = false; //不使用布局 public $layout = “main”; //设置使用的布局文件 2:在控制器成员方法内设置 $th ...
- YII与Ace Admin 的集成
目录 一. 前言... 1 二.为什么要使用YII+ace. 1 三.新建YII模块... 1 四.如何修改模板... 3 五.注意的地方... 4 六.整合的不足之处... 4 一. 前言 yii- ...
- yii2布局选择与属性标签设置
Yii选择布局的方法: 1. 通过控制器成员变量设置: public $layout = false;//不使用布局 public $layout = 'main';//设置使用的布局文件(@app/ ...
- yii2 ContentDecorator 和 block 挂件
在做网站的过程中,大部分的页面结构都是相似的.如都有相同的头部和底部.各个页面这样仅仅是中间的部分不同. Yii中的布局文件就是用来实现这样的功能.如: 布局文件:@app/views/layouts ...
- yii 修改模块使用的布局文件
方法一:yii模块默认使用系统当前的主题布局文件,如果在主配置文件中配置了主题比如: 'theme'=>'mythm', 那么yii的模块就使用 protected/themes/mythm/v ...
- YII框架的自定义布局(嵌套式布局,版本是1.1.20)
0x01 创建控制器 0x02 创建文件夹,之后创建视图文件 0x03 浏览器访问cxy/index控制器,验证 以上就是使用默认的布局,非常简单,那么如果我不想用YII框架默认的布局呢,我想用自定义 ...
- Yii 之视图布局
控制器代码: //设置的布局文件 public $layout = 'common'; public function actionAbout(){ $data = array('page_name' ...
- 关于YII中layout中的布局和view中数据的关系
1. view中解释php脚本后显示出的内容会在layout中以<?php echo $content?>输出. 2. view是对应的controller的实例,所以可以通过$this- ...
- yii笔一----基础,安装,结构,增删改查基本操作
从yii中文站开始http://www.yiichina.com/ Yii 是一个高性能,基于组件的 PHP 框架 一. 1.安装yii方式 composer安装或者下载一份应用程序模板.刚开始学习, ...
随机推荐
- android studio 怎么运行java
方法/步骤 1.新建一个project,或者如果已经有project的话,那就直接新建一个module.注意选择Java library,然后下一步 2.输入module的一些信息.点击finish ...
- Spring Cloud Config
Spring Cloud Config provides server and client-side support for externalized configuration in a dist ...
- properties 文件的中文转ASCII
在软件开发过程中,经常要涉及到多语言支持问题,常用的解决方案是将各个语言文字放到properties文件中,但中文是需要转为ASCII的 .那么如何将中文进行转换呢,下面就为你列举几种比较方便的方法 ...
- Android Studio经常使用操作技巧(不断更新)
这段时间一直在用Android Studio做一些Demo的开发.一開始从Eclipse中转向这个开发工具,各种不适应,希望此博文能够一直更新.还有网友能够分享出自己方便更好更快开发的一些技巧. 首先 ...
- 73_leetcode_Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree 1:中序和后序遍历构成一棵树.2:採用递归的方法. ...
- delphi中左右翻转窗体(修改EXStyle)
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Form ...
- linxu select 返回值
#include <sys/types.h>#include <sys/socket.h>#include <string.h>#include <netin ...
- javascript 判断IOS版本号
先来观察 iOS 的 User-Agent 串: iPhone 4.3.2 系统: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; ...
- Linux下使用Mysql
一.连接MySQL数据库 一个最简单的程序示例: #include <stdio.h> #include "mysql.h" int main() { MYSQL my ...
- Nginx 负载均衡配置和策略
Nginx 的 HttpUpstreamModule 提供对后端(backend)server的简单负载均衡.一个最简单的 upstream 写法例如以下: upstream backend { se ...