Imported From: http://groups.google.com/group/in-portal-dev/browse_thread/thread/3a1669af92586ba1#
I've recently looked at how Twig stores it's compiled templates and I liked
it. It simply creates unique class name and wraps all template contents
into it.
Usual template consists of 2 things (both optional):
- element definitions - creates a function that can be used later, but
doesn't produce any output at place, where it's defined
- tags that output something
Because right now we don't use class to wrap functions we create some crazy
hashes based on template_path+element_location+element_name.
When wrapped in a class we can improve several things:
1. only 1 weird hash per file (in class name)
2. functions, created as a result of template compilation not accessible
in global scope (no need to exclude whole /system/cache folder, just to
make auto-complete more intelligent)
3. methods in compiled templates match exact element names in that
template, so searching for a compiled method representation is easy (if you
need to debug it or something)
4. mapping between block names and their implementation points are
easier to understand (e.g. if you have an element with same name locally in
some template, then you'll see in which one exactly)
--
Best Regards,