搞好了,但是老是提示找不到模板,是不是要设置class.smarttemplate.php里的template_dir参数,应该如何设置?我设了还是提示找不到??
解决方案 »
- 请教一个编码问题
- 我装的fck,在点击插入/编辑图像按钮,但是弹出的框中没有发送到服务器上按钮即类似于浏览文件按钮,到底是出什么问题了??
- 关于php怎么修改另一个php文件中的变量值。。。新手求助
- 天数转换为小时
- 建表的问题
- 【100分求助】xml_parse_into_struct 函数解析XML,中文乱码
- 在整理smarttemplate例程手册时,遇到的一个问题,希望高手能来看一下
- 问php的编码规则(关于缩近的问题)
- 请你提议见!!!
- php网页预览乱码
- 请问PHP能读取注册表以判断某个软件是否安装吗?
- 求救!!!我下载了一个游戏,运行以后有问题,然后我的计算机就在不停的重新启动。我该怎么办呢
smarttemplate_compiled => "cache" /* temp_dir 编译临时文件目录 */,
smarttemplate_cache => "cache" /* cache_dir 缓存目录 */,
cache_lifetime => 600 /* cache_lifetime 最小编译周期 */,
template_dir => "template_dir" /* template_dir 模板目录 */
);
相关变量的解释已在代码中了,目录可用相对路径或绝对路径,视需要而定。但不能没有。并请自行保证相关目录存在并可读写。数组$_CONFIG的作用很大,你可在模板中用模板函数config输出其中内容,而无须修改程序
比如程序里有
$_CONFIG['ip'] = $_SERVER['REMOTE_ADDR'];那么你想在页面中增加用户的ip地址时,就可以直接在模板里写入{config:"ip"}
不必只在模板里写{ip},而在程序里写入$tpl->assign('ip',$_SERVER['REMOTE_ADDR']);
我是这样设置的
template_dir => "/var/www/html/template_dir/";
然后
$template = new SmartTemplate('template.html');
提示找不到
$_CONFIG['smarttemplate_compiled']='./';
$_CONFIG['smarttemplate_cache']='./';
$_CONFIG['cache_lifetime']=0;
$_CONFIG['template_dir']="E:/working/templates/";function show_news($id) {
global $tpl_frame,$tpl_body,$tpl_header,$tpl_frame,$tpl_advertisement,$tpl_book,$tpl_keyword;
$s_book=new SmartTemplate("$tpl_book");
$r_book=$s_book->result(); $tpl_adv=new SmartTemplate("$tpl_advertisement");
$r_adv=$tpl_adv->result();
$tpl_key=new SmartTemplate("$tpl_keyword");
$r_adv=$tpl_key->result(); $tpl_key=new SmartTemplate("$tpl_keyword");
$r_adv=$tpl_key->result(); $s_body=new SmartTemplate("$tpl_body");
$db_rows=_get_news_data($id);
$s_body->assign('news_body',$db_rows['introduce);
$s_body->assign('news_title',$db_rows->title);
$s_body->assign('news_time',date('Y-m-d',$db_rows->date));
$s_body->assign('news_from','');
$s_body->assign('news_nav','');
$r_body=$s_body->result();
$page=new SmartTemplate("$tpl_frame");
$page->assign('include_advertisement_tpl',$r_adv);
$page->assign('include_book_menu_tpl',$r_book);
$page->assign('include_keyword_tpl',$r_adv);
$page->assign('news_main_of_tjzl_com',$r_body); $page->output();}