Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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 crazy hashes based on template_path+element_location+element_name. 

When wrapped in a class we can improve several things:   1.

  1. only 1 weird hash per file (in class name)

...

  1. functions, created as a result of template compilation not accessible

...

  1. in global scope (no need to exclude whole /system/cache folder, just to

...

  1. make auto-complete more intelligent)

...

  1. methods in compiled templates match exact element names in that

...

  1. template, so searching for a compiled method representation is easy (if you

...

  1. need to debug it or something)

...

  1. mapping between block names and their implementation points are

...

  1. easier to understand (e.g. if you have an element with same name locally in

...

  1. some template, then you'll see in which one exactly)

...

--
Best Regards,

...