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]

Link to comment
Share on other sites

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



?>

Link to comment
Share on other sites

the class works fine but the output that is printed on the image is not appeared correctly

i try to convert every array item by using

iconv("utf-8","Windows-1256",$domnode->nodeValue);

 

but still not appeared well

 

any help please

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.