[Templates] wrapper in control?

Randal L. Schwartz merlyn@stonehenge.com
23 Aug 2000 10:32:29 -0700


>>>>> "Perrin" == Perrin Harkins <pharkins@etoys.com> writes:

Perrin> I know it's convenient to put the meta data in your templates, but it kind
Perrin> of sounds like you're going to a lot of trouble to make it work and maybe
Perrin> getting your data and presentation mixed together more than they should
Perrin> be.  What if you just made a separate template file like "filename.meta"
Perrin> that you bring in with PROCESS?  It can set a couple of values for use in
Perrin> your META tags.  Then you just need to figure out which one to load based
Perrin> on the URI of the request.


No, here's the thing.

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 ...

where the meta data and title are derived from stuff template.meta knows.
However, a smarter hello2.html can say:

        [% META title = "My smart title" keywords = "My addtional keyworsd" %]
        <h1>ho ho</h1>
        Cool stuff

and now my template.meta can notice that and use as overrides.

So I need my template.meta to be in control (PRE_PROCESS seems to
get me there), but I don't want to have to edit each naive *.html
file to have

        [% PROCESS template.meta %]

in tehre.  I want naive HTML to co-exist with my template.  That
also means that my template might want to HTML-filter (cached) to strip
an existing <HEAD> to generate my own HEAD or move it around, like

        [% PROCESS $template | my_filter %]

So, the $file wants to be hello.html or hello2.html, and PRE_PROCESS
can be template.meta.  But right now, after processing PRE_PROCESS,
it would then run hello.html again, sending out a duplicate data.
That's why I want SUPPRESS_PROCESS.

Or is there another way to do this?

Sorry if this sounds like babbling - I'm probably using some of the
terminology that's only in my test files. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!