注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 Mysql HA实现MYSQL的高可用
 帮助

简单smarty教程


2008-05-04 16:08:38
 标签:smarty 教程   [推送到技术圈]

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://xyhack.blog.51cto.com/265493/74802
index.php
<?php
require("smarty/Smarty.class.php");
$tpl = new Smarty();
$tpl->template_dir = "./templates";    //模板目录
$tpl->compile = "./templates_c";    //编译目录
$tpl->left_delimiter = "<{";      // 左右边界符
$tpl->right_delimiter = "}>";
$tpl->assign('contents',array('555-222-9786','636826@163.com',array('555-444-333','666-123-777')));
$tpl->display('index.tpl');
?>
 
index.tpl
<{$contents[0]}><br />
<{$contents[1]}><br />
<{$contents[2][0]}><br />
<{$contents[2][1]}><br />
 
output
555-222-9786
636826@163.com
555-444-333
666-123-777

本文出自 “xyhack” 博客,请务必保留此出处http://xyhack.blog.51cto.com/265493/74802



上一篇 linux文件系统 



    文章评论
 
 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: