[Templates] wrapper in control?

Perrin Harkins pharkins@etoys.com
Wed, 23 Aug 2000 11:04:48 -0700 (PDT)


On 23 Aug 2000, Randal L. Schwartz wrote:
> I want a naive hello.html to be:
> 
>         <h1>Hi there</h1>
>         How's life?
> 
> And have that wrappered with my template.meta as:
> 
>         ... stuff above ...
>         <h1>hi there</h1>
>         how's life
>         ... stuff below ...

Okay, but you could have a hello.meta like this:

[% title = "My smart title" keywords = "My additional keywords" %]

And pull that in from your wrapper, which I assume already knows you are
looking for "hello" on this request.  You can put the PROCESS in a
TRY/CATCH so that if the file doesn't exist you'll just continue and use
the defaults in the wrapper.

This might sound like more trouble, maintaining separate data files for
META data, but it separates the data from the template in a way that is
usually desirable.  You could also make hello.meta an XML file and use the
XML plugin to read it if you prefer to be buzzword compliant.

- Perrin