Blogger Information
Blog 1
fans 0
comment 0
visits 578
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
include block load 简化模板和引入外部资源
Original
578 people have browsed it

网页框架经常有一些通用的部分,为了方便开发经常会进行分离操作和调用

初级简化:在view模板目录里新建public文件夹将头部、尾部等公用的代码单独放入新建的相应模板 即include 标签 {include name=“public/header”/}

高级简化:上面初级简化的进一步简化,可以新建base母框架页面即{block name="header"}头部内容 {/block}区块然后引入子页面{block name="header"}这里可填非通用内容 {/block};若要引用母模板内容可在子模板{block name="header"} {__block__} {/block}; 母模板只运行出现 include 和block 两种标签。

引入外部资源:例如:public/static 下面引入的类库和css样式,就可以用load 来简化,即可以将<script type="text/javascript" src="__STATIC__/static/h-ui.admin/js/H-ui.admin.page.js"></script> 变成 {load href=“_STATIC__/static/h-ui.admin/js/H-ui.admin.page.js”} ,注意load只有一个属性即href

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post