Smarty integration

ill
ill's picture

Joined: 2002-08-15
Posts: 756
Posted: Wed, 2005-03-09 16:43

Is there any particular reason why you choose smarty as page renderer?

Somehow I missed the initial integration and am not able to find the correct thread in the forum about the decision. Any other page renderer in the contest back then?

I am using smarty in big PHP applications as well, but am not happy at all, because it has backdoors (like $php to integrate "far" php code during the rendering phase).

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-03-09 16:49

what's bad about having this "backdoor" of using {php} in smarty? AFAIK we don't do this at all, but people can do this, if they wish to customize their templates.

if you don't find a "why smarty" topic with the search function, then maybe only bharat will know :)

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Fri, 2005-03-11 05:11

Smarty has a secure mode that lets you disable these backdoors. This is good because sooner or later we're going to want to allow users to hack on template files via the UI and we'll want to prevent them from introducing hacks into the host site...

I chose Smarty because 3 years ago it seemed like the best and most complete PHP rendering engine. I don't see anything better than it now (but I haven't done a comprehensive comparison in a long time...)

 
ill
ill's picture

Joined: 2002-08-15
Posts: 756
Posted: Fri, 2005-03-11 10:37

Didn't knew about that secure mode, thanks for pointing!

Today, I would choose a TAL (template attribution language) implementation which seaminglessly includes additional attributes within exisiting HTML-Tags instead of introducing new Tags or Substitutions.

Reason is, that the standard Webdesigner usually is more graphically oriented and his HTML tool is not able to cope with new Tags. Hence the design usually is broken in his tool and testing is hard. Frontpage and other tools usually don't like PHP or HTML with other if-then-else structures.

TAL changes this. Design HTML as usual. Then add desired functionality into the HTML-Tags. If changements are required, they are easily incorporated.

There are TAL-implementations for PHP, even not far from here, on SF :-)

See examples:
http://www.phpmvc.net/docs/guides/guidesIdx.php?doc=adv-pg-layout-tal
http://phptal.motion-twin.com/introduction.html

I know, it's probably to late... But I was thinking on how about making templating easier.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2005-03-12 07:18

That's pretty neat. I think that if that were available 3 years ago I would have seriously considered it. I'll install it and play with it; I'm curious to see how they do their conditional logic. I've seen models similar to this before; there's one for JSP that I used at work a while back. Generally it's nice for small things, but using XHTML for conditionals and looping gets really cumbersome...