Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Smarty PHP: sucks for me

Status
Not open for further replies.

psymonj

Programmer
Mar 31, 2005
49
GB
Does anyone here use Smarty PHP template engine?

If so, does it actually save you any time?
I've been tasked with a project that used Smarty and I can't say that I find it very intuitive, easy or time saving.

This may be largely due to my inexperience with the syntax but from what I can see, it's a large distraction from the code.

Any thoughts or suggestions on my new pet-hate?

Simon Clements-Hawes
 
Ditto that.

My team recently acquired responsibility for a few multimedia sites that use Smarty, and I really don't care for it. I guess it would be nice if you have a strict separation between the front- and back-end development. So if you've got web designers who are solely responsible for the markup and PHP developers who are solely responsible for the back-end, then I can see how Smarty might be useful to the designers.

In our case, though, it's pretty much useless. The only people working on our markup are the developers who work on the back-end stuff, and we're all quite experienced with PHP. So far, I haven't seen anything Smarty can do for us that we can't do ourselves with little to no extra effort.
 
I think it really depends on how you want to develop your sites.
For example if you want to go down the MVC route (Model View Controller) to seperate your business logic and database access logic from the presentation layer (e.g. you might want to create presentation layers for specific browsers, or disabled friendy browsers or even mobile devices) so you end up with a load of reuseable backend code , a very thin front end and a controler to implement navigation logic than Smarty is A way to go.
I recall it has some syntax to support things like alternative colouring or rows in tables and the like.
 
create presentation layers for specific browsers

> Devices maybe, all code should degrade well regardless of the language used (IMO)
If coded properly, you shouldn't need to create a seperate version specifically for disabled viewers.

I recall it has some syntax to support things like alternative colouring or rows in tables and the like.
> Hardly a nightmare to implement in real PHP really.

But I agree with your point: "I think it really depends on how you want to develop your sites."

Simon Clements-Hawes
 
i've taken to developing sites to use wordpress as a template engine and cms. with a custom template and a few judicious plugins you get a really usable CMS that you can deploy to a client.
 
It really depends on how much of a CMS one is ready to deploy
I strongly feel that a client could add pages only upon a strict tpl system in order not to mess with the html.
I made my own, OOP based, using a tpl system that keeps the “look” separated from the “php engine”. Season the whole thing with an editor like FCK or SPAW
And you get a decent system.
I always rely on adapting mine to a new situation.

I tried smarty but probably did not spend enough time to fully understand it. It is wrongly said that one can use it in a heart bit; if you need a cookie cutter result then it might be true otherwise it calls for quite a long learning experience.

On the same topic how do you cope with users pasting from MSW even when overwriting the editor code it could sometimes get messy.
 
>> On the same topic how do you cope with users pasting from MSW even when overwriting the editor code it could sometimes get messy.

I wrote a PHP routine to handle the text users might paste from the evil that is Word. I don't want all that bulky (and often wrong) code polluting my work.
It converts all the special chars, line breaks and such. Handles lists and appropriates line break and paragraph tags seemingly well.

Another route is to use a rich-text editor such as TinyMCE. It's one of the most configurable editors I've found (not looked hard) and is a perfect addition to any CMS IMO.

Simon Clements-Hawes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top