seco Posted January 15, 2008 Share Posted January 15, 2008 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] Quote Link to comment https://forums.phpfreaks.com/topic/86122-call-to-a-member-function-on-a-non-object/ Share on other sites More sharing options...
rajivgonsalves Posted January 15, 2008 Share Posted January 15, 2008 you variable name is wrong $digram->Draw(); should be $diagram->Draw(); Quote Link to comment https://forums.phpfreaks.com/topic/86122-call-to-a-member-function-on-a-non-object/#findComment-439791 Share on other sites More sharing options...
seco Posted January 15, 2008 Author Share Posted January 15, 2008 thanks for reply i change it and still nothing is drawing !! Quote Link to comment https://forums.phpfreaks.com/topic/86122-call-to-a-member-function-on-a-non-object/#findComment-439795 Share on other sites More sharing options...
rajivgonsalves Posted January 15, 2008 Share Posted January 15, 2008 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(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/86122-call-to-a-member-function-on-a-non-object/#findComment-439802 Share on other sites More sharing options...
seco Posted January 15, 2008 Author Share Posted January 15, 2008 im sorry one last question the non English text not appeared correctly any idea why? Quote Link to comment https://forums.phpfreaks.com/topic/86122-call-to-a-member-function-on-a-non-object/#findComment-439855 Share on other sites More sharing options...
seco Posted January 15, 2008 Author Share Posted January 15, 2008 i see that the class i attached above has method called setdefaultfont() it accepts numbers only !! can i set the font that my local language can appears well with it? thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/86122-call-to-a-member-function-on-a-non-object/#findComment-439920 Share on other sites More sharing options...
seco Posted January 15, 2008 Author Share Posted January 15, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/86122-call-to-a-member-function-on-a-non-object/#findComment-440075 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.