anjan Posted June 1, 2012 Share Posted June 1, 2012 Hi, I have a problem regarding SimpleXMLElement Object, on echo the XML it return SimpleXMLElement Object ( [bulletPoint] => Array ( [0] => 4 Beds [1] => 1 Reception [2] =>1 Reception [3] => Furnished [4] => Shower [5] ) ) How can I make it like : * 4 Beds * 1 Reception * 1 Reception * Furnished * Shower Its VERY VERY URGENT Quote Link to comment Share on other sites More sharing options...
Barand Posted June 1, 2012 Share Posted June 1, 2012 What does your original XML look like? What is your current code? Quote Link to comment Share on other sites More sharing options...
anjan Posted June 1, 2012 Author Share Posted June 1, 2012 <Property> <Refnumber>5.00</Refnumber> <Number>41</Number> <Street>Gladston Park Gardens</Street> <Address3>LONDON</Address3> <Bulletpoints> <BulletPoint>3 Beds</BulletPoint> <BulletPoint>1 Reception</BulletPoint> <BulletPoint>1 Bathroom</BulletPoint> <BulletPoint>Furnished</BulletPoint> <BulletPoint>Shower</BulletPoint> </Bulletpoints> <Other> <Dishwasher Caption="Dishwasher">True</Dishwasher> </Other> </Property> Can I use foreach...?? Quote Link to comment Share on other sites More sharing options...
Barand Posted June 1, 2012 Share Posted June 1, 2012 foreach ($xmlobj->xpath('//BulletPoint') as $point){ echo "$point<br/>"; } Quote Link to comment Share on other sites More sharing options...
anjan Posted June 1, 2012 Author Share Posted June 1, 2012 its showing Fatal error: Call to a member function xpath() on a non-object in D:\xampp\htdocs\sunlite\wp-content\themes\sunlite\property-details.php on line 141 Quote Link to comment Share on other sites More sharing options...
anjan Posted June 1, 2012 Author Share Posted June 1, 2012 I am attaching the PHP page.. 18503_.php Quote Link to comment Share on other sites More sharing options...
anjan Posted June 1, 2012 Author Share Posted June 1, 2012 Showing but it display all the bullet point in the XML..I want to make a condition.. Quote Link to comment Share on other sites More sharing options...
anjan Posted June 1, 2012 Author Share Posted June 1, 2012 Fixed, I have change the code little bit : <?php foreach ($bullts->xpath('BulletPoint') as $point){ ?> • <?php echo $point."<br/>"; ?> <?php } ?> Thanks for your help.. Quote Link to comment 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.