• YII 实现布局


    布局文件:

    <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>



  • 相关阅读:
    kafka控制测试发送接收消息
    Kafka 启动报错java.io.IOException: Can't resolve address.
    java问题 2019
    java各种面试问题
    java 架构师
    开源的13个Spring Boot 优秀学习项目!超53K星,一网打尽!
    Dubbo 18 问
    Synchronized用于线程间的数据共享,而ThreadLocal则用于线程间的数据隔离。
    XMind2TestCase 工具,提供了一个高效测试用例设计的解决方案(开源)
    windows下面安装Python和pip终极教程
  • 原文地址:https://www.cnblogs.com/zfyouxi/p/5113405.html
Copyright © 2020-2023  润新知