ヤ林木森森
lmss · 2007-04-18
<< 常用正则表达式
|
首页
|
最强dw插件MXKol3-3_6_5 >>
2007-04-18
smarty体验。
- [
smarty
]
版权声明
:转载时请以超链接形式标明文章原始出处和作者信息及
本声明
http://lmss.blogbus.com/logs/5070059.html
第一次使用SMARTY。
main.php
PHP 代码:
include "../libs/Smarty.class.php";
$tpl = new Smarty();
$tpl->template_dir = "templates";
$tpl->compile_dir = "templates_c";
//$tpl->config_dir = . "/configs/";
//$tpl->cache_dir = "/cache/";
$tpl->left_delimiter = '<{';
$tpl->right_delimiter = '}>';
?>
test.php
PHP 代码:
require
"main.php"
;
$array1
= array(
1
=>
"苹果"
,
2
=>
"菠萝"
,
3
=>
"香蕉"
,
4
=>
"芭乐"
);
$tpl
->
assign
(
"array1"
,
$array1
);
$tpl
->
display
(
"test.html"
);
?>
test.html
HTML 代码:
"text/html; charset=GB2312"
>
</span>测试重复区块<span>
利用 section 来呈现 array1
<{section name=loop loop=$array1}>
<{$array1[loop]}>
<{/section}>
随机文章:
[插件]同时检测两个栏位
2005-12-06
三阶连动下拉选单
2005-09-18
[DW2004插件] 倒计时插件
2005-09-18
[DW2004插件] 截取字符长度
2005-09-18
[DW2004插件] 利用插件制作HTML的新闻系统
2005-09-17
收藏到:
Del.icio.us
Tag:
smarty
引用地址:
林木森森
发表于
10:00:33
|
编辑
|
继续话题
|
转发
|
推荐
原始快照:web.archive.org