Kelly Hallman said:
> Apr 6 at 5:33pm, Angelo Zanetti wrote:
>> hi all has anyone used smarty before? what do you think of it? I think
>> it's pretty nice to seperate your script (code) from your design.
>> i would like to hear your comments and if you have any alternatives
>
> There are a lot of templating systems for PHP, but I chose Smarty because
> it seemed the most feature-laden, and likely to have continued support.
> I wanted to standardize on something, so I went for the most ubiquitous.
> Really, I couldn't be happier with it in every regard.
>
> At first it may seem like more than you need, but continue working with it
> and you'll find new design strategies that take you further than you ever
> thought you'd go. It's one of those things you start using and never look
> back. I use it on almost every project now, even small ones.
>
> There are the naysayers who complain it's too bloated for basic work,
> but I think the powerful benefits far outweigh any performance issues.
> I've never felt like it was slow or too much for a given task.

Given that scripts are compiled the first time they're ran, you'll never*
notice the bloat and never lack performance; it's the same as real PHP
code and can be optimized with a caching engine like Zend.

* OK so you will notice it the first time and if you make any changes to
the file.


I just used it for the first time since I am trying to work with a real
estate agent who only had time to learn Front Page (yuk).  We were in a
tight spot, because she'd make a change to the website and I'd have to
chase after her because Front Page screwed up the code (the RocketPHP
plugin was buggy, at best, and didn't allow her to flow).

For our next site, she'll mock up everything in Front Page how she wants
it to look then I'll add template tags and business logic.  Whee!
Separation of code from design, at last!

It will be tempting to put all logic in the PHP but you might need some
logic in the template; for example, we have a level check: If the user is
at a low level he/she won't get fancy options on his profile.  This
required outputting HTML.

I could have put a tag in the template like {bio} but that'd mean
maintaining HTML in the PHP code which I wanted to avoid (left the
"prettyness" to the Front Page developer).  Instead, I put something like
this in the template:
{if $level > 2}
 {bio}
{/if}

It's extremely low-level.  I can leave the code which fetches the $level
in the PHP code and just have the checks in the template.

Hopefully you get the idea; you are recommended to leave presentation
logic in the template but all other logic should be in the back end PHP
file.

Smarty is a great templating engine which is easy to install and use on
any sized project and I highly recommend it.

/dev/idal

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to