运行网页空白一片,不知道是不是哪里没有引用正确
所有的文件夹在同一个目录下面
我自己的项目包含目前如下几个文件夹
/smarty
/smarty_cache 这个文件是我单独创建的
/templates 这个文件是我单独创建的
/templates_c 这个文件是我单独创建的
三个文件 /index.php /smarty.inc.php /templates/index.cpl
其中index.php中的内容如下:
1 assign('kaishi','这个不知到怎么样,测试看看!');5 $smarty->display('index.cpl');6 7 ?>
smarty.inc.php中的代码如下:
01 config_dir=./smarty/config_file.class.php;//目录变量设置类05 $smarty->caching=false;//不使用缓存06 $smarty->template_dir=./templates;//设置模板目录07 $smarty->complie_dir=./templates_c;//设置模板编译目录08 $smarty->cache_dir=./smarty_cache;//缓存文件夹09 $smarty->left_delimiter={;10 $smarty->right_delimiter=};11 ?>
/templates/index.cpl 中代码如下:
01 02 03 04 {$kaishi}05 06 07 08 09 hello,{$kaishi}10
11 12
运行网页之后是一片空白
回复内容: 运行网页空白一片,不知道是不是哪里没有引用正确
所有的文件夹在同一个目录下面
我自己的项目包含目前如下几个文件夹
/smarty
/smarty_cache 这个文件是我单独创建的
/templates 这个文件是我单独创建的
/templates_c 这个文件是我单独创建的
三个文件 /index.php /smarty.inc.php /templates/index.cpl
其中index.php中的内容如下:
1 assign('kaishi','这个不知到怎么样,测试看看!');5 $smarty->display('index.cpl');6 7 ?>
smarty.inc.php中的代码如下:
01 config_dir=./smarty/config_file.class.php;//目录变量设置类05 $smarty->caching=false;//不使用缓存06 $smarty->template_dir=./templates;//设置模板目录07 $smarty->complie_dir=./templates_c;//设置模板编译目录08 $smarty->cache_dir=./smarty_cache;//缓存文件夹09 $smarty->left_delimiter={;10 $smarty->right_delimiter=};11 ?>
/templates/index.cpl 中代码如下:
01 02 03 04 {$kaishi}05 06 07 08 09 hello,{$kaishi}10
11 12
运行网页之后是一片空白
你所写的代码并没有问题,出问题的地方你可能忽略了。
1,如果你是在linux下做的测试,可能是你的php报错未开。
2,是在window下作的测试。根据你描述的,只能确定的就是模板没有被解析,(不然至少会出现‘hello,’)。
你的模板文件应该都没加载到。