Re: Re: Templating engines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Clive Zagno <clive@xxxxxxxxxxxx>:
> Wait -  doesn't smarty 'compile' the php file and the tpl file into 
> another php file. If you look into templates_c directory you find some 
> 'compiled' templates.

Yes, it does. And your question is...?

If it's about performance, the compilation is not an issue. Compilation
of templates into PHP code happens only when the template file changes;
subsequent requests for the template then use the compiled version. This
actually speeds things up tremendously.

This could be interpreted as, "Well, if Smarty just compiles the
templates into PHP anyways, why not use PHP?" And the answer is that
Smarty uses a language subset -- it doesn't try to implement all of PHP,
just a number of functions that are useful to template designers (like
some basic logic, some loops, some data formatting for dates,
truncation, etc.); this subset is easier to pick up for many HTML
designers than learning PHP would be.  Additionally, the way Smarty does
tagging means that templates can often be tossed to an X/HTML validator
without the tagging causing breakage.

I'm not going to say Smarty is the best template engine out there for
PHP -- I simply haven't tried enough of them. But I made a decision to
use it and stick with it when I made the decision to start using
templates, and I haven't regretted it.

> Robert Cummings wrote:
>> On Thu, 2005-04-28 at 13:20, Ryan A wrote:
>> 
>>>On 4/28/2005 7:08:00 PM, Evert | Rooftop Solutions
>>>(evert@xxxxxxxxxxxxxxxxxxx) wrote:
>>>
>>>>Ryan A wrote:
>>>>
>>>>>So just because you use smarty you think you are smart and have the right
>>>>
>>>>to be smart..who the hell do you think you are??
>>>>
>>>>
>>>>>Sorry, just giving an example of how a jackass with extreme opinions
>>>>
>>>>would write on this holy war's volatile topic..... no offense meant
>>>>
>>>>>:-)
>>>
>>>
>>>>I would go for a xml-style template engine (start flaming right below
>>>>this thread)
>>>
>>>Flaming??? who has time to start flaming after reading what you wrote?
>>>am busying banging my head against the wall.
>> 
>> 
>> To state the obvious... the above is in actuality a flame disguised as
>> an excuse.
>> 
>> I use InterJinn, smarty, and PHP as template engines depending on what
>> the client wants and how much work they want done, and how much
>> elegance, modularity, and maintainability they want. Of the three I like
>> smarty the least which is probably why I wrote my own engine :) Oh wait,
>> I've also used eztemplate which by far takes the cake of horrible
>> horrible templating. While PHP is itself usable as a templating engine,
>> it's not what I would call clear and concise when used that way (but
>> maybe that's because I've come across too many instances where the
>> previous developer mixed business logic with display logic and then I
>> had to rework the functionality which was a nightmare :). When using
>> InterJinn I save the overhead of run-time includes incurred by using PHP
>> as a templating engine, and I save the overhead of cache checks incurred
>> by systems like smarty since InterJinn compiles to PHP source code and
>> does not use a cache (although it can be set to automatically recompile
>> pages when dependencies change).
>> 
>> At any rate I don't generally post about InterJinn here anymore since
>> some of the regulars tend to get annoyed ;)
>> 
>> Mind you I don't post much at all anymore since I became a father a year
>> and a half ago... priorities you know :)
>> 
>> Cheers,
>> Rob.


-- 
Matthew Weier O'Phinney           | WEBSITES:
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org
mailto:matthew@xxxxxxxxxx         | http://vermontbotanical.org

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux