Smarty
-
WordPress has its own…bespoke templating system right now, it’s not hugely nice or efficient or easy to use, Smarty is good, Smarty is nice, Smarty seperates code from interface. Yum. I also believe someone else if working on Smarty development atm.
However the existing functions (the_content(), the_author() etc) are not really in keeping in the Smarty-way-of-doing-things. And as such, merely writing a Smarty wrapper for the existing templating functions isn’t what you should really be doing. Instead, a rethink on the templating system would be much better.
I am an OOP whore. And hence i suggest that we use either associative arrays as the primary method of displaying data through Smarty. These objects will have all the nice pre-processing done already. They will be accessed either using {section} or {foreach} within smarty. E.g. {foreach from=$posts item=post} <h3>{$post.title}</h3> {$post.content} {/foreach} You get the idea I hope. For fancy stuff like calendars, or possibly even permalinks and such custom functions and variable modifiers will be used. E.g. {archive_calendar} or {$post.id|permalink} or {$post.author|mailto}
I don’t have time to draw up an entirely descriptive design for this, but i hope you get the general idea of what im saying. the_content() is bad and evil and will eat your children if you dont watch it carefully.
- The topic ‘Smarty’ is closed to new replies.