From: "Mathew Robertson" <[EMAIL PROTECTED]>
>
>which way is it?  either you are providing choice or you're not.

I'm sorry. I probably didn't explain the example very well.

This example is somewhat a problem of nesting, and somewhat a problem of
semi-static values.

Let's say I have 20 different top-level pages (represented by 20 CGI::App
modules). Each has its own set of sub-areas (pages produced by the module).
The side-bar navigation lists the sub-areas a visitor can go to from one
top-level page. Therefore, there is one side-bar structure which can have 20
different sets of values (depending on which module is using it).

I'd like have a top-level page include the side-bar structure which (here's
the important part) contains an include where the filename is partially
constructed by a TMPL_VAR. This way, the side-bar structure can be reused
across the 20 top-level templates, and each top-level template can specify
which list of values should be included in the structure by using a
TMPL_VAR.

      <TMPL_INCLUDE NAME="includes/navigation/area<TMPL_VAR
NAME=AREA_NUM>.html">

I can't do that because H::T (for good reason) loads all the includes at
compile time and performs variable substition at output time. This is a case
where it's not so static that the value can be hard-coded in the included
component. But, not so dynamic that all *20* list values need to be hauled
into the template and re-evaluated at output time using a gigantic <TMPL_IF>
construction. :)

I hope that's a clearer explanation.

I know I could do one of two things to get around this.

1. I could create 20 side-bar includes and simply include the correct one
for the top-level template.

The problem (possibly slight) is that I'll duplicate quite a bit of HTML to
surround the values with the entire construct. All 20 use the same general
construct, it's just the 5-10 list values comprising the actual links that
change.

2. I could organize it differently and include a side-bar_top, the specific
values, and a side-bar_bottom.

That's not the end of the world. But, it starts getting a little ugly when
what we're really talking about is nesting and semi-persistent values.

3. I could use a TMPL_LOOP and replace the values from within my CGI::App
module.

Again, not the end of the world. But, I don't need to re-evaluate with every
output of the template.

It's semi-persistant data. I can't hard code it. And, it doesn't change
after compile time.

I have another example (not involving nesting) regarding language support.
Let me think that one through and I'll write another email.

Thanks for considering this topic,

Mark



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to