Jump to content

Call to a member function on a non-object


seco

Recommended Posts

Hi

i try to use class from phpclasses.org that draw xml file into hierarchy

first i convert the xml to array then send that array to the class to draw it

it gives me error message says:

Call to a member function on a non-object

 

i have attached the source code and there is a file called test.php run it to see why it gives that error

 

thanks in advance.

 

[attachment deleted by admin]

your test.php code should be..

 

 

<?php include 'class.diagram.php';
require_once('class.xml2array.php');
function drawimage(){					
		$xmlDoc = new DOMDocument();
            if(! file_exists($xmlUrl))
                $xmlDoc->load('tree.xml');
             else
                echo('<b>This file :</b> '.$xmlUrl.' <b>Does not exist</b>');
            $resultArray = array();
           $xml2array=new xml2array($xmlDoc,$resultArray);		    
        					
				 $diagram=new Diagram();
				 $diagram->setDefaultAlign(array('data' => 'center'));    
    $diagram->setDefaultColor(array('connection' => '#f00', 'border' => '#f00'));
    $diagram->setDefaultDataColor(array('background' => '#fdd', 'color' => '#f00'));
 $diagram->loadFromArray($resultArray);
				 $diagram->Draw();

				 }

				 header("Content-type: image/jpeg");
drawimage(); 



?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.