|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
beginner Smarty n00b
Joined: 17 Mar 2005 Posts: 1
|
Posted: Thu Mar 17, 2005 10:42 am Post subject: Warning: Unknown(): Unable to call () - function does... |
|
|
Hallo,
arbeite jetzt schon ein paar Wochen mit smarty und es hat mir schon ne Menge Arbeit erspart
Jetzt hab ich aber ein kleines Problem und weiß nicht ob es evtl. an Smarty oder an mir liegt.
Folgende Warnung taucht ständig auf:
Quote: | Warning: Unknown(): Unable to call () - function does not exist in Unknown on line 0 |
Ich konnte das Problem wie folgt eingrenzen:
In meinem Beispiel sind es 3 PHP-Dateien :
config.php: hier werden Klassen deklariert (smarty/datenbank) etc.:
Code: |
require(SMARTY_DIR.'Smarty.class.php');
require(SMARTY_DIR.'SmartyValidate.class.php');
class mySmarty extends Smarty {
function mySmarty()
{..}
}
class Datenbank {
function Datenbank()
{..}
function close()
{
mysql_close($this->handle);
}
// Orte
function get_Orte()
{..}
[..]
}
|
options.php: hier werden Smarty-Variablen Werte zugewiesen, teilweise mit Hilfe der unter config.php deklarierten DB-Klassen.
Code: |
[..]
// Orte
$myDB = new Datenbank();
$ort_options = $myDB->get_Orte($user_id);
$smarty->assign('ort_options',$ort_options);
$myDB->close();
[..]
|
suche.php:
Code: |
require_once("config.php");
[..]
include("options.php");
[..]
|
Da ich die Klassendeklaration und das Füllen der Formularelemente desöfteren brauche, hab ichs einfach mit include/require 'ausgelagert'.
Der Parser bringt aber obige Fehlermeldung, sobald die Datenbank-Klasse in options.php instanziert wird, funktionieren tuts aber trotzdem.
Ich kapiers nicht, hat das mit dem Geltungsbereich der Objekte was zu tun?
Die Warnhinweise nerven mittlerweile und ich bin kein PHP-Freak, was mach ich falsch?
vielen DAnk schon mal
und gruss |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|