You could write the head from the body using the INCLUDE directive

I could, and I do on some simple sites...

However, my usual approach is to have a module that deals with all the Template processing. Besides new it usually has just three methods, head, process and foot.

head deals with preview images, page titles, external CSS/JS files, etc providing a standard setup that can be changed on a per-script basis.

foot does much the same as head but there are less variations - mostly copyright date.

process obviously processes the body script but also deals with user login state, log files, etc depending on the site's needs.

I was looking for a solution that I could just put in head that would give me the latest modification time of the body template as I don't want to start rewriting several websites just to get this information. As I don't think it's going to be possible, I'm looking at having another script that reads stat for the relevant body template file. There is still a problem with older scripts that generate the HTML within the script (the way I did it before the Wisdom of The Monastery reached me!) because the script modification time is the same for every page it generates.

But there is also the question of what is actually a modified date...if a script provides the data to a template, changing the script or changing the template could cause an update to the resultant webpage.


In reply to Re^4: Last Modified for Template file by Bod
in thread Last Modified for Template file by Bod

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.