zoukankan      html  css  js  c++  java
  • Thinkphp5模板继承

    代码 applicationindexcontrollerindex.php

    <?php
    namespace appindexcontroller;
    use appindexcontroller;
    
    class Index extends IndexBase
    {
        public function index()
        {
    
            return $this->fetch();
        }
    
        public function base ()
        {
            return $this->fetch();
        }
    }

    模板applicationindexviewindexindex.html

    {extend name="index/base" /}
    {block name="title"}
    Title:
    {/block}
    {block name="right"}
    最新资讯:
    {/block}
    
    {block name="footer"}
    {__block__}@ThinkPHP 版权所有
    {/block}

    模板applicationindexviewindexase.html

    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>{block name="title"}标题{/block}</title>
    </head>
    <body>
    {block name="menu"}菜单{/block}
    {block name="left"}左边分栏{/block}
    {block name="main"}主内容{/block}
    {block name="right"}右边分栏{/block}
    {block name="footer"}底部{/block}
    </body>
    </html>

    输出结果:菜单 左边分栏 主内容 最新资讯: 底部@ThinkPHP 版权所有

    注意:{__block__} 

  • 相关阅读:
    923c C. Perfect Security
    hdu ACM Steps Section 1 花式A+B 输入输出格式
    我回来了
    POJ–2104 K-th Number
    bzoj1009: [HNOI2008]GT考试
    bzoj1875: [SDOI2009]HH去散步
    1898: [Zjoi2005]Swamp 沼泽鳄鱼
    Hadoop
    程序员的自我修养
    Effective C++笔记
  • 原文地址:https://www.cnblogs.com/wesky/p/7127474.html
Copyright © 2011-2022 走看看