Re: Templating systems for single developers?

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

 



On Tue, 2005-05-10 at 17:17, Murray @ PlanetThoughtful wrote:
> Hi All,
> 
> So, if anyone out there uses a templating system (ie Smarty, PHPSavant etc)
> and they don't work in a team environment, I'd love to hear what benefits
> you derive from so doing.

I do for as many projects as possible. Nothing like sharing custom tags
across projects. Also something you can't do in PHP is include source
code with a function definition that has already been defined which as
many PHP developers will attest to, causes problems when importing 3rd
party code. With custom tags I can override an existing tag of the same
space/name with different functionality by assigning the compiler with
the tag to override a higher precedence in the configuration.
Additionally I can create custom tags that output other custom tags or
standard tags since evaluation is recursive (at compile time NOT
run-time). Also some of the sites I manage are in the hundreds of pages
and having the template engine index the site's searchable content via a
custom tag is quite convenient.

<search:public>
Blah blah blah blah.
</search:public>

Custom tags aren't just for content replacement as you can see, they can
provide meta functionality at arms length.

Also I like the convenience and clarity of using static accumulators to
accumulate content that will be flushed into a pre-defined position. For
instance a template like the following:
--------------------------------------------------------------------
<html>
<head>
<jinn:accumulatorFlush name="javascript"/>
<jinn:accumulatorFlush name="javascript" dynamic="true"/>
</head>
<body>
Blaaaaaaaah.
</body>
</html>
--------------------------------------------------------------------

And then a source file which will be expanded into the above main layout
template:

--------------------------------------------------------------------
<jinn:accumulate name="javascript">
<script type="text/javascript" language="javascript">
<!-- //
/*
    Some funky javascript or whatever have you.
*/
// -->
</script>
</jinn:accumulate>

<p>
Blah blah blah blah. Blah blah.
Something funky with javascript.
</p>
--------------------------------------------------------------------

As you saw in the main template declaration there were two flushes, one
is static and occurs at compile time saving any run-time overhead, the
other is dynamic and occurs at run-time (which is useful if your code
needs to output javascript).

Anyways, there's way more to all this than I can usually think of when
people ask. Experience, mine in particular, leads me to prefer the
template approach over the PHP approach. And then again my own template
approach over the smarty approach :)

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
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