Hi,
also ich habe bisher folgende Klasse:
[php]
<?php
class Dent{
function Dent()
{
global $SERVERROOT;
global $CLASSESROOT;
global $dbHost;
global $dbUser;
global $dbPassword;
global $dbName;
require_once($CLASSESROOT."control/db/mysql4db.class.php");
require_once($CLASSESROOT."design/libs/Smarty.class.php");
$smarty = new Smarty; // Create template Object
$db = new Mysql4db($create = "", $this->dbHost, $this->dbUser, $this->dbPassword, $this->dbName); // database object
//$this->dbUser = $dbUser;
$smarty->template_dir = $SERVERROOT.'smarty/templates/';
$smarty->compile_dir = $SERVERROOT.'smarty/templates_c/';
$smarty->config_dir = $SERVERRROT.'smarty/configs/';
$smarty->cache_dir = $SERVERRROT.'smarty/cache/';
}
function writeHeader()
{
$smarty->assign();
$smarty->display('header.tpl');
}
function writeTop()
{
$smarty->assign('aktuelles','Hier jibt et aktuelles');
$smarty->display('top.tpl');
}
}
?>
[php]
In einer anderen Datei steht:
[php]<?php
include("config.inc.php");
require_once($CLASSESROOT."dent.class.php");
$dent = new Dent;
$dent->writeTop();
?>
also ich habe bisher folgende Klasse:
[php]
<?php
class Dent{
function Dent()
{
global $SERVERROOT;
global $CLASSESROOT;
global $dbHost;
global $dbUser;
global $dbPassword;
global $dbName;
require_once($CLASSESROOT."control/db/mysql4db.class.php");
require_once($CLASSESROOT."design/libs/Smarty.class.php");
$smarty = new Smarty; // Create template Object
$db = new Mysql4db($create = "", $this->dbHost, $this->dbUser, $this->dbPassword, $this->dbName); // database object
//$this->dbUser = $dbUser;
$smarty->template_dir = $SERVERROOT.'smarty/templates/';
$smarty->compile_dir = $SERVERROOT.'smarty/templates_c/';
$smarty->config_dir = $SERVERRROT.'smarty/configs/';
$smarty->cache_dir = $SERVERRROT.'smarty/cache/';
}
function writeHeader()
{
$smarty->assign();
$smarty->display('header.tpl');
}
function writeTop()
{
$smarty->assign('aktuelles','Hier jibt et aktuelles');
$smarty->display('top.tpl');
}
}
?>
[php]
In einer anderen Datei steht:
[php]<?php
include("config.inc.php");
require_once($CLASSESROOT."dent.class.php");
$dent = new Dent;
$dent->writeTop();
?>
PHP-Code:
Nun kommt folgende Fehlermeldung:
Fatal error: Call to a member function on a non-object in d:\dentona_new\classes\dent.class.php on line 38
WARUM NUR?
Danke
[edit]PHP-Tags sponsored by mortalan
Kommentar