无图版
|
左右分栏
» 您尚未
登录
注册
|
搜索
|
朋友圈
|
帮助
社区服务
银行
朋友圈
搜索工具
PHP学会网 php培训网 PHP暑期培训 PHP寒假培训 PHP假期培训
»
PHP中高级
»
smarty如何包含另一个smarty文件?
交 易
投 票
本页主题:
smarty如何包含另一个smarty文件?
打印
|
加为IE收藏
|
收藏主题
|
上一主题
|
下一主题
芽雨
级别:
新手上路
精华:
0
发帖:
3
威望:
1 点
金钱:
10 PYMB
贡献值:
0 点
在线时间:0(小时)
注册时间:2005-11-06
最后登录:2006-10-05
smarty如何包含另一个smarty文件?
Posted: 2005-11-06 21:36 |
[楼 主]
芽雨
级别:
新手上路
精华:
0
发帖:
3
威望:
1 点
金钱:
10 PYMB
贡献值:
0 点
在线时间:0(小时)
注册时间:2005-11-06
最后登录:2006-10-05
smarty如何包含另一个smarty文件?
偶在.tpl文件中这样:<{include file="blog_link.tpl"}>
这样只能输出被包含文件的html部分
里面的变量无法输出
应该如何?
注:
偶两个php文件都有:
PHP代码:--------------------------------------------------------------------------------
require_once ("class/Smarty.class.php");
$smarty = new Smarty();
$smarty->template_dir = "./templates";//设置模板目录
$smarty->compile_dir = "./templates_c"; //设置编译目录
$smarty->config_dir = "./configs";
$smarty->cache_dir = "./cache";
$smarty->cache_lifetime = 60 * 60 * 24; //设置缓存时间
$smarty->caching = false; //调试时设为false,发布时用true
//----------------------------------------------------
//左右边界符,默认为{},但实际应用当中容易与JavaScript
//相冲突,所以建议设成<{}>或其它。
//----------------------------------------------------
$smarty->left_delimiter = "<{"; //设置左边界符
$smarty->right_delimiter = "}>"; //设置右边界符
require("xtsz/include.php");
require("xtsz/inc.php");
require("xtsz/total.php");
$smarty->assign(……);
$smarty->display(……);
Posted: 2005-11-06 21:36 |
1 楼
游子云
级别:
管理员
精华:
3
发帖:
246
威望:
205 点
金钱:
2066 PYMB
贡献值:
0 点
在线时间:38(小时)
注册时间:2005-10-27
最后登录:2008-08-19
在smarty中,因路径的的原因,不能解很好的解析引入php的解析模板;一般引入纯php不会出错!
例如{include_php file="/path/to/load_nav.php"}
[[i] Last edited by 游子云 on 2005-11-6 at 09:42 PM [/i]]
Posted: 2005-11-06 21:39 |
2 楼
芽雨
级别:
新手上路
精华:
0
发帖:
3
威望:
1 点
金钱:
10 PYMB
贡献值:
0 点
在线时间:0(小时)
注册时间:2005-11-06
最后登录:2006-10-05
<{include_php file="../article_index.php"}>
偶在tpl中用上面的,结果连html部分的都不输出了
Posted: 2005-11-06 21:48 |
3 楼
Tina
级别:
新手上路
精华:
0
发帖:
37
威望:
-2 点
金钱:
-20 PYMB
贡献值:
0 点
在线时间:0(小时)
注册时间:2005-10-24
最后登录:1970-01-01
你这样需要在你的tpl中包含要包含的tpl
然后在php中包含对应的php文件!
Posted: 2005-11-12 19:20 |
4 楼
快速跳至
>> php培训
|- 培训咨询和报名
>> 学员专区
|- 学员交流区
>> 开源项目
|- 项目开发
|- OSC技术交流
|- CMS开源项目研究
|- 下载
>> PHP和web开发
|- 入门和基础知识
|- PHP中高级
|- 网站SEO
|- PHP资源共享
|- YUI,ext JS
|- 数据库应用
|- 操作系统(Windows、Linux)
|- 英语学习
|- 数据结构和算法
|- web2.0
>> 信息发布
|- 招聘和求职
>> 娱乐论坛
|- BT软件&教程发布
|- BT影视&音乐
|- 娱乐乐园
>> PHP世纪
|- 站务管理
PHP学会网 php培训网 PHP暑期培训 PHP寒假培训 PHP假期培训
»
PHP中高级
今日推荐
隐藏
显示
关闭
现在时间:09-08 06:28
Copyright © 2006 phpwhy.com 版权所有
浙ICP备05060669号
关于我们 -
合作联系