[Templates] link vars to template src in ttree?

[prev] [thread] [next] [Date index for 2004/09/15]

From: Michael Higgins
Subject: [Templates] link vars to template src in ttree?
Date: 17:52 on 15 Sep 2004
Hello --

I've been using ttree to make sites. Very simple stuff.

Trying to hack out a way to get the title for each page set up for the 
header of my doco, I did this in a pre-processed config file:

[% webpages = [
{ url => "file://c:/new_/index.html";, title => "Home", id => "home" },
{ url => "file://c:/new_/ash/index.html";, title => "Beitmidrash", id => 
"beitmidrash" },
. . .
]
%]

And set up the title tag like this:

    [% FOREACH link = webpages %]
    [% urlname = link.url %]
   [% IF urlname.match (template.name) %]
     [% title = link.title %]
    [% END %]
    [% END %]

Which worked fine as long as each page had a different name. Obviously, 
this doesn't work with pages that are all named 'index.html'. So, I need 
a better way. (I have no idea where I found this one.)

So, I tried to find out what else is available (like, a path to the 
file) in  (template.????) to urlname.match but, I can't seem to do it... 
oh. Dumping the template object isn't so encouraging. Just 'name' and 
'modtime'...

So, can anyone give me a leg up here? Perhaps point me to the fine 
manual to read where I can find out how to do this properly with ttree? 
Or, better, an example?

Thanks in advance for any pointers.

-- mike higgins


_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] link vars to template src in ttree?
Michael Higgins 17:52 on 15 Sep 2004

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52