News Feed
Sections
News Archive


Community Events
php|tek 2008 PHP Conference



feed this:

DevShed:
Working with Multiple Document Nodes with the DOM XML Extension in PHP 5
0 comments :: posted Wednesday March 19, 2008 @ 07:59:49
voice your opinion now!

DevShed has posted the fourth part of their series looking at working with the DOM functionality of PHP5, this time with a focus on working with multiple document nodes inside of an XML document.

It's time to learn a few other methods included with the DOM XML extension. Based upon this premise, in this fourth tutorial I'm going to show you how to get access to multiple nodes of an XML document, either for internal processing or simply for echoing to the browser.

They show you how to grab the collection of nodes to work with and how to grab data from an XML text file with load() and loadXML().

tagged with: dom xml tutorial php5 load set collection object


Felix Geisendorfer's Blog:
Cake 1.2’s Set class eats nested arrays for breakfast!
0 comments :: posted Wednesday February 28, 2007 @ 10:04:00
voice your opinion now!

Felix Geisendorfer has a great functionality note that CakePHP users might want to check out. It's related to the Set class and how it handles nested arrays.

So far this has been a little dark spot for me in the core and from my previous quick looks at the class I've never been quite able to figure out what it's exact purpose was. Until now all I knew was "well it's probably some fancy array manipulation code that is somewhat obfuscated and undocumented". Oh boy, I wish I had spent more time on this earlier. It's probably one of coolest new features in 1.2 and nobody realizes it.

He starts with a simple example of how the class works with a nested array of user information. Normally, you'd loop through the array and append the values you'd need to another array (like the user's name), but with Set, it's as simple as calling the static "extract" method with the "path" to what you want out of the array. A simple one-line replacement for a (normally) three to four line bit of code.

He gives a few other examples using this same user information, grabbing various results and includes one at the end that is very nice indeed - pulling in an XML document, running it through a simple xmltoArray function and pulling out the titles in a few easy lines.

tagged with: set class cakephp nested array extract combine xml parse set class cakephp nested array extract combine xml parse


PEAR package zend releases ajax PHP5 book release security code framework pecl developer conference job cakephp mysql database zendframework application

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