smarty模板三种变量来源

来源:互联网 发布:万捷网络验证系统 编辑:程序博客网 时间:2024/05/16 04:51

smarty模板三种变量来源
1.通过assign赋值

$smarty->assign('name','value');

2.smarty的系同保留变量

{$smarty.now} 获取当前时间{$smarty.const}  获取常量{$smarty.capture} 获取smarty捕获的内容{$smarty.config} 获取smarty的配置文件{$smarty.section} 用来指向{section}循环的属性,里面包含一些有用的值,比如.first/.index等。
{$smarty.template} 返回经过处理的当前模板名{$smarty.current_dir} 返回经过处理的当前模板目录名{$smarty.version} 返回经过编译的smarty模板版本号{$smarty.block.child} 返回子模板文本块{$smarty.block.parent} 返回父模板文本块{$smarty.ldelim}, {$smarty.rdelim} 用来打印left-delimiter和right-delimiter额字面值

3.配置文件中的配置变量
在模板页中药使用配置变量
3.1 加载配置文件:{config_load file=’文件1’}
3.2使用配置变量{$smarty.config.配置项}/{#配置项#}

0 0