从Discuz中抠出的模板类
时间:2010-06-07
来源:互联网
这个也是改自网上,在php4.4.7下测试暂时没发现问题。。
用得上就拿去,里面还有一个示范。undefinedundefined
- /************************************************************
-
- Discuz 模板引擎类
-
- 1、去掉了 Discuz 语言包的功能
-
- 2、移植 Discuz 模板中所有的功能
-
- 3、添加了自动更新缓存及生命周期功能
-
- ************************************************************/
-
- header("Content-Type: text/html; charset=utf-8");
-
- require_once ('classes/template.class.php');
-
-
-
- $options = array(
-
- 'template_dir' => 'templates/', //指定模板文件存放目录
-
- 'cache_dir' => 'templates/cache/', //指定缓存文件存放目录
-
- 'auto_update' => true, //当模板文件有改动时重新生成缓存 [关闭该项会快一些]
-
- 'cache_lifetime' => 1, //缓存生命周期(分钟),为 0 表示永久 [设置为 0 会快一些]
-
- );
-
-
-
- $template = new Template(); //使用单件模式实例化模板类
-
- $template->setOptions($options); //设置模板参数
-
-
-
- /*
-
- // 可以使用以下三种方法设置参数
-
- $template->setOptions(array('template_dir' => 'templates/default/')); //用于批量设置时使用
-
- $template->set('template_dir', 'templates/default/');
-
- $template->template_dir = 'templates/default/');
-
- */
-
-
-
- $testArr = array('testa' => 'KKKKKKKKKKKKKK', 'testb' => 'YYYYYYYYYYYYYY');
-
-
-
-
-
- $www='www.phpx.com/happy';
-
- $ifopen=-1;
-
- $itemlist=array(
-
- "a"=>array(
-
- "color"=>"red",
-
- "size"=>"big"
-
- ),
-
- "b"=>array(
-
- "color"=>"green",
-
- "size"=>"small"
-
- )
-
- );
-
-
-
-
-
- $str =array(
-
- $str1 =array(
-
- "url"=>"/a/b/c/2008-1-28.html",
-
- "title"=>"Discuz 模板引擎类",
-
- "author"=>"chinahtml",
-
- "time"=>"2008-1-28 12:12:50"
-
- ),
-
- $str2 =array(
-
- "url"=>"/a/b/c/2008-1-29.html",
-
- "title"=>"Discuz 6.0下载",
-
- "author"=>"discuz",
-
- "time"=>"2008-1-29 13:18:15"
-
- ),
-
- $str3 =array(
-
- "url"=>"/a/b/c/2008-1-30.html",
-
- "title"=>"喜悦国际村真喜悦",
-
- "author"=>"sadly",
-
- "time"=>"2008-1-30 23:12:24"
-
- )
-
-
-
- );
-
-
-
- function getstr($string)
-
- {
-
- if ($string==1)
-
- {
-
- return $str_array=array(array(
-
- "url"=>"/a/b/c/2008-1-29.html",
-
- "title"=>"Discuz 6.0下载",
-
- "author"=>"discuz",
-
- "time"=>"2008-1-29 13:18:15"
-
- ));
-
- } elseif ($string==2) {
-
- return $str_array=array(array(
-
- "url"=>"/a/b/c/2008-1-30.html",
-
- "title"=>"喜悦国际村真喜悦",
-
- "author"=>"sadly",
-
- "time"=>"2008-1-30 23:12:24"
-
- ));
-
-
-
- }
-
- }
-
-
-
- include($template->getfile('test.htm'));
作者: RICHARD 发布时间: 2010-06-07
作者: 月夜 发布时间: 2010-06-07
月夜 发表于 2010-6-7 16:53
PPC现在内部………………贼忙………………
作者: 我为ぁ琴狂 发布时间: 2010-06-07
楼主是DZ的!?
作者: 饭牛 发布时间: 2010-06-07
还加了个AJAX的处理。。。
作者: guxiaochuan 发布时间: 2010-06-09
月夜 发表于 2010-6-7 16:53
作者: wu1jun 发布时间: 2010-06-09
作者: kisshe 发布时间: 2010-06-09
作者: see7di 发布时间: 2010-06-24
see7di 发表于 2010-6-24 01:08
同上
作者: fzphp 发布时间: 2010-08-05
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28