I assume you can handle your own extraction of the data from the database, and are only looking for guidance on using HTML::Template for this kind of stuff.

To answer your second question first, have someone who is a good HTML designer design a calendar page for you in HTML. It will have rows and columns.

Now alter the design by reducing all the rows to one, but put that inside a TMPL_LOOP:

<table> <TMPL_LOOP name="calendar"> <tr> <td><TMPL_VAR name="sideheader"></td> <td <TMPL_IF name="holiday_1">bgcolor="mauve" </TMPL_IF>> <TMPL_VAR name="day_1"> </td> <td <TMPL_IF name="holiday_2">bgcolor="mauve" </TMPL_IF>> <TMPL_VAR name="day_2"> </td> <!-- ETC for the rest of the row --> </tr> </TMPL_LOOP> </table>
And then simply assign appropriate values to the positions in each row such that the days of the month align properly with days of the week (leaving empty spaces at the start or at the end, as appropriate).

Come to think of it, the same method would work for the first table - in fact there it's easy to see that it's months going along the row, so you can give your columns more intuitive names.

One last thing. When making links, I prefer to use a cleaned up self_url from CGI.pm, and have <TMPL_VAR>s in the HTML. That way, the script and template will work, even if they are moved into another directory, or to another server.


In reply to Re: Can I do this??? by matija
in thread Creating reports with HTML::Template and CGI::Application by bar10der

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.