您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

smarty 模板if else使用实例与入门教程

2024/10/13 11:22:16发布33次查看
标签是给smarty的指令符,以模板定界符包住。这些指令符可以是变量,以$符号代表函数、逻辑 或 流程控制 语法。smarty 允许 php 程式设计师以smarty 标签去定义可存取的函数
smarty 模板if else使用实例与入门教程
smarty 主要功能是完成美工与程序分离,并且使用的缓存技术,减轻服务器的负载,
smarty 以在文件中放置特殊的“smarty标签”来产生网页内容。这些标签会被处理并替换成其他的内容。
*/
require('smarty/libs/smarty.class.php教程');
$tpl = new smarty();
$tpl->template_dir   = 'd/'
$tpl->compile_dir    = 'd/template_c';
$tpl->compile_check   = false;//$cfg['debug'];
$tpl->debugging      = false;
$tpl->caching       = false;
$tpl->cache_lifetime  = 3600;
$tpl->left_delimiter  = '';
$array = 'www.111cn.net'
$tpl->assign('datalist', $array);
$tpl->display('a.tpl');
/*
a.tpl
echo 'aaa';
还有另一种方法
{if $name eq 'fred'}
    welcome sir.
{elseif $name eq 'wilma'}
    welcome ma'am.
{else}
    welcome, whatever you are.
{/if}
{* an example with or logic *}
{if $name eq 'fred' or $name eq 'wilma'}
   ...
{/if}
本文章原创于www.111cn.net转载注明出处
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product