<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sun, 07 Sep 2008 03:00:38 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[DotVoid.com: Reordering nested sets using PHP and Javascript]]></title>
      <guid>http://www.phpdeveloper.org/news/8658</guid>
      <link>http://www.phpdeveloper.org/news/8658</link>
      <description><![CDATA[<p>
On the DotVoid blog today, <i>Danne Lundqvist</i> has <a href="http://www.dotvoid.com/view.php?id=78">posted about a problem</a> he had - creating parent/child style data and displaying it as nested sets with the combination of PHP and Javascript. He outlines two different methods but only chooses one to run with.
</p>
<p>
The first method is "adjancency", a method that involves storing a parent ID in each node and recursing to find the related ones. He goes with a different solution, however - a "nested set". This method stores the data in terms of where it's located on the tree (layers from right, layers from left, etc).
</p>
<blockquote>
Last night I was working on an application that display a full tree where the user must be able to to drag and drop nodes to reorder the tree. The problem is that it is much more difficult to insert or reorder the tree using the nested set model.
</blockquote>
<p>
This was particularly effective in solving <a href="http://www.dotvoid.com/view.php?id=78">his problem</a>, making a reogranizable listing that could be manipulated via a Javascript interface (the <a href="http://youmuppet.com/?page_id=9">MooTree</a> script from <a href="http://www.mootools.net/">MooTools</a>). Hi sPHP solution is included.
</p>]]></description>
      <pubDate>Fri, 14 Sep 2007 14:44:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Felix Geisendorfer's Blog: Cake 1.2's Set class eats nested arrays for breakfast!]]></title>
      <guid>http://www.phpdeveloper.org/news/7360</guid>
      <link>http://www.phpdeveloper.org/news/7360</link>
      <description><![CDATA[<p>
<i>Felix Geisendorfer</i> has a <a href="http://www.thinkingphp.org/2007/02/24/cake-12s-set-class-eats-arrays-for-breakfast/">great functionality note</a> that CakePHP users might want to check out. It's related to the Set class and how it handles nested arrays.
</p>
<blockquote>
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.
</blockquote>
<p>
He <a href="http://www.thinkingphp.org/2007/02/24/cake-12s-set-class-eats-arrays-for-breakfast/">starts with</a> 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.
</p>
<p>
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.
</p>]]></description>
      <pubDate>Wed, 28 Feb 2007 10:04:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Tobias Schlitt's Blog: Avoid an endless pifall]]></title>
      <guid>http://www.phpdeveloper.org/news/7285</guid>
      <link>http://www.phpdeveloper.org/news/7285</link>
      <description><![CDATA[<p>
<i>Tobias Schlitt</i> has <a href="http://schlitt.info/applications/blog/index.php?/archives/523-Avoid-an-endless-pifall.html">provided a helpful hint</a> for developers working with lots of objects, methods, and singleton patterned functionality to keep out of the same trouble he faced.
</p>
<blockquote>
During my current exam phase I'm working on some tiny private project to relax after learning. In there I'm using a main controller class, which implements a singleton pattern and initializes several sub-controllers while being created. The singletons purpose is, that the other controllers can access to main controller and its functionality whenever they need, without storing a reference each.
</blockquote>
<p>
The problem with the code (he gives snippets) was a recursive loop that was suddenly appearing. He finally tracked it down to a constructor in another class that was accessing the main controller's constructor. The issue was that the constructor was never finishing up, so a valid instance wasn't returned, so the whole thing started all over again.
</p>]]></description>
      <pubDate>Thu, 15 Feb 2007 09:03:00 -0600</pubDate>
    </item>
  </channel>
</rss>
