首页 > 编程 > PHP > 正文

YII实现布局

2020-03-22 16:47:23
字体:
来源:转载
供稿:网友
  • 布局文件:

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

    位置:


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

    我们系统默认的布局文件是colum1.php

    使用布局文件:


    布局文件具体与什么有关系:

    控制器渲染视图renderPartial()此方法不会渲染布局

    render()这个方法会渲染布局。

    现在我们布局已经做好了:

    1. 制作布局文件layouts/文件名字,使用$content代表普遍模板内容。

    2. 设置布局文件,在父类控制器里边html' target='_blank'>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>


    PHP编程

    郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。

  • 发表评论 共有条评论
    用户名: 密码:
    验证码: 匿名发表