初识Smarty模板的小问题
时间:2011-10-19
来源:互联网
刚下的smarty3,按照说明稍微部署了下,运行里边儿的测试页面 index.php(http://localhost/Smarty/demo/index.php)一切正常。
参照某个教程自己做了一个页面出现问题了: 打开http://localhost/Smarty/demo/test.php 里面全是空白。
samrty放置路径:F:\work\PhonesCalls\Smarty;
main.php (F:\work\PhonesCalls\Smarty\libs\main.php):
PHP code
test.php (F:\work\PhonesCalls\Smarty\demo\test.php)
PHP code
test.html (F:\work\PhonesCalls\Smarty\demo\templates\test.html)
PHP code
找了半天还是没发现是逻辑上面的问题还是代码的问题
参照某个教程自己做了一个页面出现问题了: 打开http://localhost/Smarty/demo/test.php 里面全是空白。
samrty放置路径:F:\work\PhonesCalls\Smarty;
main.php (F:\work\PhonesCalls\Smarty\libs\main.php):
PHP code
<?php include "libs/Smarty.class.php"; define('__SITE_ROOT', 'F:/work/PhonesCalls/Smarty/demo'); $tpl = new Smarty(); $tpl->template_dir = __SITE_ROOT . "/templates/"; $tpl->compile_dir = __SITE_ROOT . "/templates_c/"; $tpl->config_dir = __SITE_ROOT . "/configs/"; $tpl->cache_dir = __SITE_ROOT . "/cache/"; $tpl->left_delimiter = '<{'; $tpl->right_delimiter = '}>'; ?>
test.php (F:\work\PhonesCalls\Smarty\demo\test.php)
PHP code
<?php require "main.php"; $tpl->assign("title", "测试用的网页标题"); $tpl->assign("content", "测试用的网页内容"); $tpl->display('test.html'); ?>
test.html (F:\work\PhonesCalls\Smarty\demo\templates\test.html)
PHP code
<html> <head> <meta http-equiv="Content-Type" c> <title><{$title}></title> </head> <body> <{$content}> </body> </html>
找了半天还是没发现是逻辑上面的问题还是代码的问题
作者: johnsneaker 发布时间: 2011-10-19
main.php你Require进去了否?
作者: ZT_King 发布时间: 2011-10-19
拷贝你index.php的配置试下
作者: heyli 发布时间: 2011-10-19
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28