• 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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • rayne


    I totally agree with this idea. Having the ability to use the loops that smarty supplies, the user has more flexibility in how they set up their pages. This will be especially useful to those users who are switching from Movable Type and are used to having maximum flexibility in their templates.

    Moderator Matt Mullenweg


    You get more flexibility in Smarty than PHP? I think not. Smarty can be as flexible as PHP, but then you end up with just a metalanguage on top of PHP whose main advantage is having curly braces instead of opening and closing PHP tags. If we were to do a post loop, we would probably have a custom block function, so like:
    {posts cat="1" last="10"}

    Or something of the like. Thanks for your comments.

    Re: foreach loops – you recognize we have a foreach loop for the posts and the comments already, correct?

    I agree with allusion and Moose.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Smarty’ is closed to new replies.