passing DOMDocument Object to another function
| From: | jonathan | Date: | Wed, 28 Sep 2005 20:33:51 +0000 |
| Subject: | passing DOMDocument Object to another function | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-40406@lists.php.net to get a copy of this message | ||
I am accessing information in my database. If the format is set to be html, I echo out the variables just fine. If the format is
set to be xml, I create a DOMDocument.
The problem is that in processing the result set, it calls several other functions. How do I pass the DOMDocument Object to these other functions? Do I need to pass the DOMElement Object to this other function? The "normal" ways don't seem to be working. I even just global'd the DOMDocument and DOMElement and that also didn't work.
sample code:
if($this->format=='xml')
{
$dom=new DOMDocument('1.0', 'utf-8');
$menu_top=$dom->appendChild($dom->createElement('menu'));
print_r($dom);
print_r($menu_top);
}
else
{
echo $row['menu_name'] . "<br>";
}
$this->renderChildrenMenu($row['id']);
}
if($this->format=='xml')
{
echo $dom->saveXML();
}