发布于 2015-11-24 11:24:09 | 161 次阅读 | 评论: 0 | 来源: PHPERZ

这里有新鲜出炉的YII 2.0教程,程序狗速度看过来!

Yii高性能PHP框架

Yii Framework是一个基于组件、用于开发大型 Web 应用的高性能 PHP 框架。Yii提供了今日Web 2.0应用开发所需要的几乎一切功能。Yii是最有效率的PHP框架之一。Yii是创始人薛强的心血结晶,于2008年1月1日开始开发。


布局文件:

<div>我是头部</div>
<!--展示首页、登录、注册等代码信息-->
<!--$content代表我们已经提取出来的首页、登录、注册等页面信息(没有头部和脚部)-->
<?php  echo $content; ?>

<div>我是尾部</div>


位置:

布局文件已经实现出来,下面我们需要使用这个布局文件

我们系统默认的布局文件是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>




最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务