How should I be using Smarty?

Soldato
Joined
2 May 2004
Posts
19,950
Hi,

I've made a couple of posts on Smarty in the past asking about it, but I've never really got round to learning how to use it properly.

I got the Guestbook example/tutorial from the Smarty website to check it out properly...

Basically their guestbook example has queries in one file, logic in another (if/else etc) and then calls functions from those two.

Should I be getting my head around trying to use Smarty like it was used in the guestbook example? Or is it just as good to use it normally? (Queries, logic together).

Thanks
Craig.
 
One of Smartys primary design goals is to facilitate the separation of application code from presentation. Typically, the application code contains the business logic of your application, written and maintained in PHP code. This code is maintained by programmers. The presentation is the way your content is presented to the end user, which is written and maintained in template files. The templates are maintained by template designers.

Why use smarty...

So, in answer to your question, you should use it like it is intended (the guestbook example) :)
 
I found the Smarty manual to be absolutely diabolical in illustrating its power; I'd recommend a third party tutorial to nail the basics then refer to the manual when delving deeper.
 
Or drop Smarty all together and just use plain old PHP for it's originating purpose; and just separate the layers yourself instead of relying on bloated software to perform a needless translation.
 
Back
Top Bottom