YATS (Yet another templating system)
| From: | Dan Libby | Date: | Tue, 15 Feb 2000 18:05:12 +0000 |
| Subject: | YATS (Yet another templating system) | ||
| Groups: | php.template | ||
| Request: | Send a blank email to php-template+get-25@lists.php.net to get a copy of this message | ||
Okay, so a few weeks ago I was tasked with writing a templating system
for use with PHP capable of separating content from display. We had
looked at FastTemplate, but found it much too slow for production use.
I agreed, on the condition that I could open source it when done.
I spent a few days and hacked together a PHP module. So far, we haven't
really used the system beyond my limited testing, and it no doubt
contains many bugs. In particular, I added cacheing of templates across
multiple requests (not a big win, unfortunately) which requires using
real malloc and was somewhat painful to do with Zend's hashtable and
macros, which use emalloc by default. So I expect problems there. But
I digress....
The design is also derived from fasttemplate, but deviates more
significantly, I think. In particular, parsing occurs only once, when
the template is defined/loaded. Thus, there is no need for
parse_dynamic(). The template syntax is also different. It allows
nested dynamic sections. It does not allow conditionals, but has
support for an "alt" parameter if the requested variable is not found.
Other parameters may be defined as needed due to the {{var key1="val"
key2="val"}} syntax. There is support for implicit looping, and
(optional) automatic hiding of sections with undefined variables.
Anyway, I was wondering what to do with this code. I could place it on
sourceforge, or try to get it into the PHP distro, or sit on it. I was
happy to discover this list and andrei's proposal sounds similar in many
regards to what I had come up with. I have some documentation, which
I am including with this mail (readme.HTML). I would like to hear your
feedback on my design, and would also appreciate any thoughts on how
best to distribute the code.
regards,
-dan