index.php 和 index.tpl (index自身也包含一些查询最新产品的几个sql语句,所以要分离,美工改html,我改php)
left.php 和 left.tpl(因为left包含sql查询数据库的分类,为了html和数据查询分离,也要分为2个文件)我是index.php导入index.tpl模版,index.tpl导入left.php,left再导入的left.tpl模版
问题就来了,
index.php需要require conn.php,left.php也需要require conn.php总是报错(如果index引入了,left不引入又不出结果)
还有2个tpl都要require smarty_config.php(自己写的一个统一的smarty的配置文件)好像也有问题。你们是怎么写这个东东的,还是我思路有问题
left.php 和 left.tpl(因为left包含sql查询数据库的分类,为了html和数据查询分离,也要分为2个文件)我是index.php导入index.tpl模版,index.tpl导入left.php,left再导入的left.tpl模版
问题就来了,
index.php需要require conn.php,left.php也需要require conn.php总是报错(如果index引入了,left不引入又不出结果)
还有2个tpl都要require smarty_config.php(自己写的一个统一的smarty的配置文件)好像也有问题。你们是怎么写这个东东的,还是我思路有问题
把 require 改为 require_once()就不会报错了,而且正确。
可以改成 include 或者只需要在index里调用 一次就行了
index.php需要require conn.php,left.php也需要require conn.php
还有2个tpl都要require smarty_config.php
重復require了conn.php和smarty_config.php
把require改為require_once
require_once("../smarty/config.php");
require_once("../include/conn.php");这些东东我都试完了,还是不行,你们看看,我的完整版的吧
http://bbs.blueidea.com/viewthread.php?tid=2933139&pid=4577739&page=1&extra=page%3D1###
require("../smarty/config.php");
require("../include/conn.php"); 再引用require("include/left.php");--虽然这个left.php只做了相关的sql查询,还是要单独引用一次index.tpl嵌入left.tpl
index.php显示index.tpl模版,完了,呵呵,我最开始想混了.....谢谢各位了。。