0

We use Smarty and time to time it really takes a lot of time for it to render a template. Normally it works fine, but sometimes (like 1 random pageview out of 1 000) it takes about 5 seconds to render a template. We don't use smarty functions or plugins, just simple variables. What might be wrong, where to look? Templates are already compiled and they don't change before the 'slowdown'.

1
  • Are the templates already compiled, or is it after they have changed? for the record I'm a fan of Smarty.
    – Toby Allen
    Dec 29, 2009 at 11:32

1 Answer 1

1

Maybe not exactly what you're looking for, but still an answer:

If you're only working with variables and maybe simple loops and control structures, I'd recommend using another PHP-based template system. After all, PHP was designed to be a template language.

This approach has multiple positive sides:

  1. You don't have to learn yet another syntax.
  2. You lose the extra overhead of adding yet another layer on top of PHP, which in large parts duplicates what PHP can already do.
4
  • Yeah, implementing Smarty was big mistake, but we can't go back easily :-( see my question here stackoverflow.com/questions/436014/… Nov 19, 2009 at 10:19
  • 1
    I'd like to add that in my eyes even things like truncating an article preview or even converting 1000000 bytes to (about) 1 MB is presentation logic. And that kind of stuff gets really messy and ugly in Smarty.
    – Franz
    Nov 19, 2009 at 10:29
  • Why would you be truncating a preview in smarty? That doesnt make any sense, you should do that in php?
    – Toby Allen
    Dec 29, 2009 at 11:33
  • 1
    Why not? If a designer decides to suddenly show the complete article instead of just a truncated part, there's nothing he can do (on his own). Displaying all of a message or only part of it is presentation logic in my eyes - it has nothing to do with the flow of the program...
    – Franz
    Dec 29, 2009 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.