+ -
当前位置:首页 → 问答吧 → Smarty配置出错了,help

Smarty配置出错了,help

时间:2010-08-16

来源:互联网

我第一次接触Smarty,求帮助

1 <?php
2 require"smarty/libs/Smarty.class.php";
3 $smarty = new Smarty;//设置各个目录的路径,这里是安装的重点  
4 $smarty->template_dir ="smarty/templates/templates";  
5 $smarty->compile_dir = "smarty/templates/templates_c"; 
6 $smarty->config_dir = "smarty/templates/config";  
7 $smarty->cache_dir ="smarty/templates/cache";   //smarty模板有高速缓存的功能,如果这里是true的话即打开caching,但是会造成网页不立即更新的问题,当然也可以通过其他的办法解决  
8 $smarty->caching = false;  
9 $hello = "Hello World!";//赋值  
10 $smarty->assign("hello",$hello);//引用模板文件  
11 $smarty->display('index.html');
12 ?>

错误信息如下:
Parse error: syntax error, unexpected T_VARIABLE in F:\XAMPP\xampp\htdocs\DreamWaver PHP\PHP\learn\index.php on line 5


是什么原因呀?

作者: @wenzi   发布时间: 2010-08-16

<?php
/*
* Created on 2007-5-14
* Programmer : Alan , Msn - [email protected]
* PHP100.com Develop a project PHP - MySQL - Apache
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/

include_once('./class/Smarty.class.php');

//******************
   $smarty = new smarty();
   $smarty->template_dir = "./templates";
   $smarty->compile_dir  = "./templates_c";
   $smarty->config_dir   = "./config";
   $smarty->cache_dir    = "./cache";
   $smarty->caching      = false;
   $smarty->left_delimiter = "<%{";
   $smarty->right_delimiter = "}%>";

?>
这是我配置的类文件  你看看 你文件名正确不

作者: jerrymsj   发布时间: 2010-08-16

作者: ferss   发布时间: 2010-08-16