Hi all

There may be a better way of doing this that I don't know about, but
assuming there isn't:

Context:
--------
 - I'm running a number of white labelled sites, in each of which, 
   there may be 400 "sub-brands"

 - Each white label site has it's own template which sets the the 
   configuration variables relevant for that site

 - However, it also needs to choose from one of these 400 sub-brands,
   which it does by using a key from a hash (which is essentially
   a constant)

This means that each time that template is called, it needs to
instantiate a hash with 400 key/value pairs.  This is not exactly a huge
performance hit, but it takes 'some' processor time.

I could pass this hash through the CONSTANTS param, but it makes more
sense to me to store these values within this site-specific template,
rather than having different stored in different places.

Proposal:
---------
  - some form of BEGIN block, which would get processed only when
    the template is first loaded and cached

  - this would mean that eg my hash would be built once, but then
    would remain accessible

  - I can't actually think of any other purpose for this, so maybe
    the BEGIN block would actually be a CONSTANTS block, and
    it could be possible to make these variables read only?

This is just a thought, not sure how much sense it makes, or if there is
already some better way to do this, but I thought I'd put it to the
list.

thanks

Clint





_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to