先说下模板继承:

  假定:在View文件夹中

     -> Public  公共模块

          —>base/header/top/footer 4个html文件

这下面base文件使用include引入其他3个文件,其中title用block标签,给个name属性,在不同的模板中可以实用block来重新定义title值,

block 标签,属性是main的可以,在不同的模板的写不同的内容

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title><block name="title">标题</block></title>
</head>
<body>
    <include file="Public/header" />
    <include file="Public/top" />
    <block name="main"></block>

    <include file="Public/footer" />
</body>
</html>
View Code

相关文章:

  • 2022-01-17
  • 2022-12-23
  • 2021-05-27
  • 2021-12-22
  • 2022-01-16
猜你喜欢
  • 2022-02-07
  • 2021-08-03
  • 2022-02-07
  • 2021-10-19
  • 2022-03-09
相关资源
相似解决方案