As if the title doesn’t give away the whole plot, I’m currently working on a project that uses PHP–gasp! No, I’ve not abandoned ColdFusion, and too be completely honest, I’m kind of a PHP noob.

Sure, I can do a fair amount of things in PHP…you know, querying databases, echoing content, that kind of stuff. Where I really get hurt, though, is when things start to get complex.

NOTE: If you don’t particularly feel like reading and just want to see some code, be sure to check out my GitHub repo for this.

Some Context

For example, I recently needed to build out an ExtJS View, and I wanted to have some pretty heavily-nested data. My ideal outcome would print something to the page like so:

Main Group 1
   Category 1
      Name 1
      Name 2
         Fav Color 1
         Fav Color 2
Main Group 2
   Category 1
      Name 1
      Name 2
Main Group 3
   Category 2
      Name 1
   Category 3
      Name 1

And so on. In other words, each step in the “tree” can have multiple children, which can themselves have multiple children, ad infinitum.

Now in ExtJS, creating a View is dead simple. You simply have to pass the View a JSON structure wherein each level is More >