For the same project as I posted about yesterday, I’m making extensive use of Smarty. Today I wrote a plugin that will convert the output of NestedSet into a nicely formatted HTML list. The one thing that took a while to work out was that if a smarty ‘modifier’ plugin is applied to an array, it will be applied to each element of that array. I wanted my modifier to be applied to the array as a whole and to do that I had to prefix the modifier call with an ‘@’. ie:
results in my_modifier being applied to each element of $my_array in turn.
results in my_modifier being applied to the whole array.
Once I had that clear, a simple recursion had the whole thing working nicely. Now to integrate it with the rest of the application…