smarty 静态页面
来源:互联网 发布:盛世网络剧在线观看 编辑:程序博客网 时间:2024/05/21 11:00
section.php
<?php
require "smarty.inc.php";//加载模板引擎
$tpl->assign('title',"section循环");
$contact= array(
array('name'=> '孙某','fax'=> '1234', 'email' => 'luo@123','phone' => '123456'),
array('name'=> '随某','fax'=> '1234', 'email' => 'luo@123','phone' => '123456')
);
$tpl->assign('contact',$contact);
$tpl->display('section.tpl');
$output = $tpl->fetch("section.tpl");
//输出静态页面的路径
$PageName = "./section.html";
$fp = fopen($PageName,"w");
fwrite($fp,$output);
fclose($fp);
?>
section.tpl
<!DOCTYPE HTML>
<HTML lang="zh-CN">
<head>
<title>联系人信息表</title>
</head>
<body>
<table border ="1" width ="80%" align ="center">
<caption><h1>联系人列表</h1></caption>
<tr>
<th>姓名</th><th>传真</th><th>电子邮件</th><th>联系电话</th>
</tr>
<{section name=line loop=$contact}>
</tr>
<td><{$contact[line].name}></td>
<td><{$contact[line].fax}></td>
<td><{$contact[line].email}></td>
<td><{$contact[line].phone}></td>
</tr>
<{sectionelse}>
<p>数组$contact中没有任何值</p>
<{/section}>
</table>
</body>
</html>
有图有真相:
- Smarty生成静态页面
- smarty 静态页面
- smarty生成静态页面
- smarty实现静态页面练习
- php生成静态页面+smarty生成静态页面
- php+smarty生成静态页面详解
- Smarty生成静态页面的方法
- PHP生成静态页面(ob_start+smarty)生成
- Smarty 实现页面静态化、生成HTML
- smarty模板清除静态页面练习
- 使用smarty模板或缓存实现页面静态化
- smarty生成静态页
- smarty静态缓存
- smarty静态缓存
- 利用PHP与Smarty模板技术生成分页静态页面的代码
- 利用PHP与Smarty模板技术生成分页静态页面的代码
- smarty页面局部缓存
- smarty 页面显示问题。。。。。
- C语言中sprintf()函数的用法
- 学习
- 存储过程和sql语句的优缺点
- 一个双向链表+Vector查找
- 中科院中文分词系统ICTCLAS之人名识别词典分析
- smarty 静态页面
- sharedPreference用法
- 数据仓库逻辑区域及各区域的功能和特点
- ant 调用子任务
- C语言四种常用排序
- OGNL一些知识
- 文件夹拒绝访问
- C语言 时间戳和标准格式的转换
- VC编译错误总结