passing DOMDocument Object to another function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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();
    }

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux