最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
smarty include 实例教程
时间:2022-07-02 10:46:22 编辑:袖梨 来源:一聚教程网
实例教程
{include file='page_header.tpl'}
{* body of template goes here, the $tpl_name variable
is replaced with a value eg 'contact.tpl'
*}
{include file="$tpl_name.tpl"}
{include file='page_footer.tpl'}
{include} passing variables
{include file='links.tpl' title='Newest links' links=$link_array}
{* body of template goes here *}
{include file='footer.tpl' foo='bar'}
输出
{$title}{/h3>
{foreach from=$links item=l}
.. do stuff ...
{foreach from=$links item=l}
.. do stuff ...
{include file='nav.tpl' assign=navbar}
{include file='header.tpl' title='Smarty is cool'}
{$navbar}
{* body of template goes here *}
{$navbar}
{include file='footer.tpl'}
Example 7-20. Various {include} resource examples
{* absolute filepath *}
{include file='/usr/local/include/templates/header.tpl'}
{* absolute filepath (same thing) *}
{include file='file:/usr/local/include/templates/header.tpl'}
{* windows absolute filepath (MUST use "file:" prefix) *}
{include file='file:C:/www/pub/templates/header.tpl'}
{* include from template resource named "db" *}
{include file='db:header.tpl'}
{* include a $variable template - eg $module = 'contacts' *}
{include file="$module.tpl"}
{* wont work as its single quotes ie no variable substitution *}
{include file='$module.tpl'}
{* include a multi $variable template - eg amber/links.view.tpl *}
{include file="$style_dir/$module.$view.tpl"}
相关文章
- 无期迷途主线前瞻兑换码是什么 11-22
- 原神欧洛伦怎么培养 11-22
- 炉石传说网易云音乐联动怎么玩 11-22
- 永劫无间手游确幸转盘怎么样 11-22
- 无期迷途主线前瞻兑换码是什么 无期迷途主线前瞻直播兑换码介绍 11-22
- 《潜行者2:切尔诺贝利之心》神出鬼没成就攻略分享 11-22