a work on process

Smarty Notes

You are reading a post by James Stewart entitled Smarty Notes. It was posted on 28 January 2005 at 3:09 pm.

You can find more posts by returning to the index.

Filed under: Snippets
Tagged: , ,

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:

{$my_array|my_modifier}

results in my_modifier being applied to each element of $my_array in turn.

{$my_array|@my_modifier}

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…

Recommend this post:

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Related Posts

 

No Comments »

No comments yet.

TrackBack URI

Leave a comment

Login Method

OpenID

Anonymous