> > On Tue, 2003-06-10 at 12:46, Jon Ross wrote:
> > > If I load some data into a hash & pass it to a template, when a
> > link from
> > > that template/page is pressed how do I access the data 
> again in the 
> > > subsequent handler/template ?.
> > >
> > > The reason being - I have a top-level category bar which is
> > available on all
> > > pages but only requires loading from the database on the initial 
> > > page.
> >
> > This has absolutely nothing to do with Template Toolkit, but the 
> > simplest approach is to cache the data using a module like 
> > Cache::Cache or MLDBM::Sync.
> 
> Apologies if it was an off-topic question - not knowing what 
> the answer is makes it difficult to know where to ask the question.
> 
> My reason for asking here is that I had assumed there was a 
> way of making template data available to all subsequent 
> templates rather than having to re-process it (even if from 
> the cache) with every template.

I wonder if this may help you. If I undertsnad it right your want the 
same hash available for every template only building the hash once whenever you update 
it?

Ok assuming that, why not put the hash in a separate file:

hash.lib:
%hash = (..);
1;

In your templat eprocessing script :

require 'hash.lib';

Then just add %hash to your list of goodies to process and viola! You only have the 
hash in one place instead of building it every time and if you want to update it you 
can update the lib file and you're set!

Not sure if that's what you're looking for but HTH.

DMuey


 

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to