有人可以帮忙吗,我收到这个错误:
Fatal error: Call to undefined method stdClass::AddFile() in C:\xampp\htdocs\index.php on line 8
***更新这是我的 index.php 的新内容:
<?php
define('IN_INDEX', 1);
include ('inc.php');
$TPL = new CoreScript_TPL();
$TPL->TPLDir = 'themes/'.$hotel[temp].'';
if(!isset($_GET['page']) || $_GET['page'] == 'index') {
$TPL->AddFile('index');
}
echo $TPL->Run();
?>
inc.php 包含一些包含,配置,class.template.php 和我的 core.tpl.php,女巫是这样的:
<?php
class CoreScript_TPL {
public $TPLData;
public $TPLDir;
public $TPLVars = array();
function AddFile($FileName) {
if(file_exists($this->TPLDir . '/' . $FileName . '.tpl')) {
$this->TPLData .= file_get_contents($this->TPLDir . '/' . $FileName . '.tpl');
return true;
}
else
return false;
}
function AssignVar($Variable, $Value) {
$this->TPLVars[$Variable] = $Value;
}
function Run() {
$OutputData = $this->TPLData;
foreach($this->TPLVars as $key => $value) {
$OutputData = str_replace('{'.$key . '}', $value, $OutputData);
}
return $OutputData;
}
}
?>
需要做的是从 config.php 请求主题名称并显示该主题.. 但它没有......有人可以帮忙吗?
顺便说一句,对不起我的英语不好,我是荷兰人....
谢谢,
韦斯利·皮特斯
**更新:
我的 class.template.php
if (!empty($TPL)) {
//Dingen die met het hotel te maken hebben
$TPL->setParameter('longname', $_CONFIG['hotel']['longname']);
$TPL->setParameter('shortname', $_CONFIG['hotel']['shortname']);
$TPL->setParameter('theme', $_CONFIG['hotel']['template']);
$TPL->setParameter('ip', $_CONFIG['hotel']['ip']);
$TPL->setParameter('build', $_CONFIG['hotel']['webbuild']);
$TPL->TPLDir = 'themes/'.$theme.'';
//Dingen die met SWF's te maken hebben
$TPL->setParameter('ext_vars', $_CONFIG['swf']['externalvars']);
$TPL->setParameter('productdata', $_CONFIG['swf']['productdata']);
$TPL->setParameter('furnidata', $_CONFIG['swf']['furnidata']);
$TPL->setParameter('external_texts', $_CONFIG['swf']['externaltexts']);
$TPL->setParameter('swfpath', $_CONFIG['swf']['path']);
//Overige
$TPL->setParameter('twitteruser', $_CONFIG['social']['twitter']);
$TPL->setParameter('fbuser', $_CONFIG['social']['facebook']);
}