And putting code of any sort into the template wasn't exactly what I was hoping for.

Well, I don't consider putting presentational code near the templates as a sin :-) So, to pick one of your examples, if I was looking at a TT2 solution I'd package up a TT2 Officers plugin that wrapped up all the presentation aspects of the officers and then have a template that did something like:

[% USE Officers %] ... <table> <tr> <th>Name</th> <th>Phone</th> </tr> [% FOREACH officer = Officers.by_name %] <tr> <td>[% officer.name %]</td> <td>[% officer.phone %]</td> </tr> {% END %] </table> ...

So the [% USE Officers %] tells the template, and therefore ttree, what code needs running. I find something like this is often a nice solution. I'm providing a clean presentation object that can't be perverted into evil business logic in the templates, and the designers can go do presentational things with Officers wherever they like without me having to touch any more code.


In reply to Re^5: Generation of dynamically-static documents by adrianh
in thread Generation of dynamically-static documents by Tanktalus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.