problem on dynamic function call inside a class!
anyone face this problem before ??
problem on dynamic function call inside a class!
<?php
class ADemo{
.
.
.
function tag_close($parser,$name) {
// This function first looks for a handling function for the
// current tag. If there is none, the tag gets passed through.
// If a handling function exists, execute it and add its return data
// to the contents of the stack element under it
// The name of the tag handling function
// i try this
$function='$this->'."handle_".strtolower($name);
echo "(".$function.")";
// Fetch the content and attributes of the current tag from the stack
$data=$this->pop();
if(function_exists($function)) {
// The tag handling function exists. Execute it!
//get an error message here, how to do that call
//I woluld like to know how to call it
$buffer=call_user_func($function,$data["contents"],$data["attrs"]);
}
else {
// No handling function for this tag. Pass it through.
$buffer=create_xml_tag($this->name, $data["attrs"], $data["contents"]);
// Create a string with the attributes in XML format
}
// Take the converted tag and add it to the contents of the tag around it
$sublevel=$this->pop();
$sublevel["contents"].=$buffer;
$this->push($sublevel);
}
.
.
.
// a set of pre define dynamic function here
function xxxx
}
the class generated the following error
==============================
Fatal error: Call to undefined function: create_xml_tag() in c:\program files\easyphp1-7\www\cmd\ActivityParser.php on line 144
Last edited by antony_csf; 06-29-2004 at 11:18 PM.
|