TP5 模板继承
application\index\controller\Index.html
<?php
namespace app\index\controller;
use think\Controller;
class Index extends Controller
{
public function index()
{
return $this->fetch();
}
public function base ()
{
return $this->fetch();
}
}
application\index\view\index\index.html
{extend name="index/base" /}
{block name="title"}
标题2
{/block}
{block name="right"}
阅谁问君诵,水落清香浮。
{/block}
{block name="footer"}
{__block__}@Onestopweb 版权所有
{/block}
application\index\view\index\base.html
<!DOCTYPE html>
<html lang="zh">
<head>
<meta 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>
注意:{__block__}
效果图:
