目录映射/配置中的问题

时间:2010-08-04 08:09:58

标签: php directory

我的索引文件是 -

include("application.php");

$DOC_TITLE = "MyMarket Home";
include("$CFG->templatedir/header.php");
?>
//html page code

<?
include("$CFG->templatedir/footer.php");
?>

application.php代码 -

error_reporting(15);

/* define a generic object */
class object {};

$CFG = new object;

/* database configuration */
$CFG->dbhost = "localhost";
$CFG->dbname = "mymarket";
$CFG->dbuser = "root";
$CFG->dbpass = "";


$CFG->wwwroot     = "http://localhost/mymarket";
$CFG->dirroot     = dirname(__FILE__);
$CFG->templatedir = "$CFG->dirroot/templates";
$CFG->libdir      = "$CFG->dirroot/lib";
$CFG->imagedir    = "$CFG->wwwroot/images";
$CFG->icondir     = "$CFG->imagedir/icons";
$CFG->bannerdir   = "$CFG->imagedir/banners";
$CFG->support     = "support@mymarket.org";
$CFG->version     = "1.71";
$CFG->sessionname = "mymarket";

/* extended configuration */
$CFG->showsponsor   = true;     // enabled banner advertising
$CFG->currency      = "$";
$CFG->currencyfirst = true; // show the currency symbol before the price tag

/* define database error handling behavior, since we are in development stages
* we will turn on all the debugging messages to help us troubleshoot */
$DB_DEBUG = true;
$DB_DIE_ON_FAIL = true;

/* load up standard libraries */
require("$CFG->libdir/stdlib.php");
require("$CFG->libdir/dblib.php");
require("$CFG->libdir/mymarket.php");
require("$CFG->libdir/cart.php");
...

&gt;&gt; 这些文件位于xampp-&gt; htdocs-&gt; mymarket
但是,当我尝试运行显示此错误的应用index.php页面 templatedir / header.php“);?&gt;
// html page
 templatedir / footer.php“);?&gt;

甚至购物页面都有一些错误。一些strating代码 -

include("../application.php");

$id = nvl($_REQUEST["id"], 1);
$qid_c = get_sub_categories($id);
$qid_p = get_products($id);

$DOC_TITLE = "Shopping Catalog";
include("$CFG->templatedir/header.php");
include("templates/catalog.php");
include("$CFG->templatedir/footer.php");
...

我认为我已正确设置了$CFG->wwwroot$CFG->dirroot个变量,这就是为什么会出现这个目录映射问题。

1 个答案:

答案 0 :(得分:1)

不应该是这样的吗?

  

包括( “{$ CFG-&GT; TEMPLATEDIR} /header.php”);

  

include($ CFG-&gt; templatedir。“/ header.php”);