Re: Re: Question about template systems

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

 



On Wed, Mar 4, 2009 at 7:01 PM, Michael A. Peters <mpeters@xxxxxxx> wrote:

> Robert Cummings wrote:
>
>> On Wed, 2009-03-04 at 15:21 -0800, Michael A. Peters wrote:
>>
>>> Robert Cummings wrote:
>>>
>>>  To punt what is repeated over and over during runtime to a single
>>>> compilation phase when building the template target. To simplify the use
>>>> of parameters so that they can be used in arbitrary order with default
>>>> values. To allow for the encapsulation of complex content in tag format
>>>> that benefits from building at compile time and from being encapsulated
>>>> in custom tags that integrate well with the rest of the HTML body.
>>>>
>>>
>>> I can't speak to those (and I have no opinion on template systems having
>>> never used any of them.
>>>
>>>  To
>>>> remove the necessaity of constantly moving in and out of PHP tags.
>>>>
>>> php does not require that you constantly move in and out of PHP tags.
>>> There's at least one and possibly several pure php solutions that allow
>>> one to never write a line of html but get beautiful dynamic html output.
>>>
>>
>> It doesn't require, but if you're not moving between them, then you're
>> probably echoing your HTML, and that can be a maintenance nightmare.
>>
>
> echoing html involves mixing html and php.
> Using an XML class (like DOMDocument) to build the document does not.


ive actually written a little templating system which subclasses
SimpleXMLElement to achieve just that, take a peak at the syntax if you like
(any feedback appreciated),

http://nathan.moxune.com/phacadeDemo/

the syntax toward the bottom is what i really liked when i was starting
out.  the demo page is about as far as i got w/ it, though.  what i ended up
not liking about it, is how its joined at the hip w/ xml.  suppose i want to
template other things,.. css, js, php all come to mind.

i could do that w/ pure php, and im sure any of these other systems such as
smarty could let you template things beyond a subset of xml.  what i like
about this blitz module, and Rob's TemplateJinn, is an additional emphasis
on performance.

the other thing that i cant understand in general about templating is the
whole notion of making things easier for so-called "designers", ui folks or
w/e, who arent used to 'code'.  in my personal experience, i have yet to see
anyone actually doing that right, or anything close to it in a real
environment.  im not trying to say there is one way and only one way to use
a templating system, but im just saying that is a halmark benefit, which i
dont think ive ever seen in practice..  what i see is programmers using them
b/c they feel its hepling them separate presentation and logic.

that said, i think folks really should look at what templating solutions are
doing or can do in their environment.  i dont know, most templating systems
look pretty similar to me from a distance, smarty & savant look
fundamentally similar.  you have a class which you populate with data, and
then those are mapped into placeholders in template files.  the rest of the
differences seem skin deep to me, but if im missing something, id love to
know.

sorry for the rant,

-nathan

[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