in reply to Creating reports with HTML::Template and CGI::Application

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.

Replies are listed 'Best First'.
Re: Re: Can I do this???
by bar10der (Beadle) on Mar 03, 2004 at 16:57 UTC
    Thanks Matija,

    Looks like you have shown me some light..though I have made a slight change in design, to me extracting data in the format I have mentioned for 1st screen will be bit difficult...any thoughts/suggestions are welcomed.

    So instead of displaying plan for entire year, I decided to display current month with next and prev month buttons at top. This will be much easier to implement. Then using the tmpl_loop, as suggested above I will have to create a monthly calander with each holiday dates highlighted against all names. Any suggestions?