I'm a newbie to tt2, and yes I've gone through the docs, at least in part.

I'm using tt2 to redo my website.  I'm doing a set of static pages.  The
whole site will be order 100 pages.

First kick at the cat was a set of templates that worked

[% INCLUDE header.inc %]
[% INCLUDE {section}nav.inc %] #wehre section was the result of the top nav.

content division

[% INCLUDE footer.inc %]

*********************************************
It occurs to me that if my inc file knew the name of the calling file,
I could take actions on that basis.

The notion I have at present:

Arbitrary tty file.:


[% INCLUDE header.inc
       name.section= "Foo:
%]
[% INCLUDE ${name.section}_nav.inc
       name.subsection = "Bar"
%]

...

So header.inc can then format the top level nav bar, showing
the currently selected link as being different.

I.e. My top level has 5 section pages, Home, Trees, Advice, Forests, Links
So the home page, which has 8 subpages would start
with name.section = "Home" and name.subsection = "Welcome"


Then the include file would recieve "Home" as a parameter.
so when it's formating the navbar it can check for a match
between the nav item and Home, and if it is a match, format it differently.

However this is still two items to customize for each file. Given
how often I've had to go back and correct the title and desc meta data
because I missed it in my first attempt, I'm hoping there is an automatic
way to streamline this.

Is there a parameter or environment variable in tt2 that
corresponds to $0 in a perl script?   That is, the name
of the template currently being processed.

Similarly is there one that is the name of the calling template.

Thus.  name.self = name.0 = name of current template.
          name.parent = name.1= name of calling template.
          name.grand  = name.2 = name of calling template's callng tempalte.
          name.top = name.last = top level template.

This is something that has enough obvious uses to me I'm sure
that it exists in tt2 somewhere.  I just am missing the
section on where to look for it.  Pointers deeply appreciated.

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

Reply via email to