News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

CodingThis.com Blog:
Quick XML-to-HTML Templating in PHP Using SimpleXML
November 11, 2010 @ 13:03:04

New on the CodingThis.com blog there's a post about templating using SimpleXML to parse a basic XML file and push the data into a template.

Since the API method interface is relatively static, I didn't need to generate it on the fly, so I created a PHP script. I could have used an XSL Transform (XSLT), but instead I decided to use pure PHP. (I'd rather use PHP and realize I have too much power than use XSLT, and realize I don't have enough. Plus, I love PHP. There's no shame in sticking with what you know.) [...] The best package I found for my purposes is SimpleXML, which mimics the tree structure of an XML file as a series of embedded objects.

He gives an example of some simple XML returned from his REST API, how parsed it and a foreach loop to go through the methods and output the HTML with the correct values.

0 comments voice your opinion now!
template simplexml tutorial rest api


blog comments powered by Disqus

Similar Posts

Ben Ramsey's Blog: Build PHP 5.4 on CentOS 6.2

SitePoint PHP Blog: Translation and Text-to-Speech with Microsoft Translator

Rob Allen's Blog: Zend Framework Tutorial Zip File Updated

NETTUTS.com: How to Create Your First Joomla Template

Stefan Mischook's Blog: Setting up an MVC structure with the Zend Framework - part 1


Community Events





Don't see your event here?
Let us know!


code list zendserver introduction community threedevsandamaybe interview series symfony deployment voicesoftheelephpant api laravel language podcast bugfix conference release tips framework

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework