Hi again.
I've managed to tidy up my code as much as possible, and attached is
where i stand at the moment.
If someone could take a look and help I would be extremely grateful.
I have hashed out "sub week_day" as I am totally stumped as to how to
solve that issue.
I'm not sure if resolving that will clear up other issues in my
counting, but as you can see the page doesn't look too healthy.
What I am attempting to do at this point is create 6 rows / 7 columns,
ergo, count 42.
I have forced $mystart to be a negative number.
My aim...
Print a non-value for $mystart < 1
Print a red value for $i 1,8,15,22,29,36
Print a black value for other 1..31
Print a non-value for remainder of 42 count.
thanks
Brian
ps I'm switching between using strict and not using it.
but, as is, it needs to be off to get anywhere.
#! c:\perl\bin\perl.exe -T
use warnings;
#use strict;
use CGI qw/:all/;
use CGI::Carp qw/fatalsToBrowser/;
use HTMLTMPL;
my $t = HTMLTMPL->new();
my $q = new CGI;
my ( $day, $mon, $year ) = ( localtime )[ 3, 4, 5 ];
my $today = $year + 1900;
$t->output( CGI::header );
################################################################################################################################
################################################################################################################################
################################################################################################################################
################################################################################################################################
&leading_stuff;
{
########################## start of January ############################
($mystart == -1)
&table_top;
&month_table;
&day_head;
&mycount42_31;
sub mycount42_31 {
for ($i == 1..42) {
if ($mystart < 1) {
&up_from_zero;
}
if (($mystart >= 1) && ($mystart <= 31)) {
&week_start_sunday;
# &week_day;
}
&week_day_blank;
&week_end_saturday;
$mystart++;
$i++;
}
}
########################## end of January ############################
&footer;
############## subs below #######################
sub table_top {
print "
<table width=\"810\" align=\"center\" cellspacing=\"10\"
bgcolor=\"#003399\">"
}
sub month_table {
print "
<tr>
<td width=\"220\" height=\"250\" bgcolor=\"#003399\"><table
width=\"220\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<th bgcolor=\"#FFFF33\" scope=\"col\">$myjan<\/th>
<\/tr>
<\/table>"
}
sub day_head {
print "
<table width=\"220\" border=\"1\" cellpadding=\"0\"
cellspacing=\"0\" bordercolor=\"#999999\" bgcolor=\"#FFFFFF\">
<tr>
<th height=\"27\" scope=\"col\"><div align=\"center\"
class=\"style7\">Sun<\/div><\/th>
<th height=\"27\" scope=\"col\"><div align=\"center\"
class=\"style8\">Mon<\/div><\/th>
<th height=\"27\" scope=\"col\"><div align=\"center\"
class=\"style8\">Tue<\/div><\/th>
<th height=\"27\" scope=\"col\"><div align=\"center\"
class=\"style8\">Wed<\/div><\/th>
<th height=\"27\" scope=\"col\"><div align=\"center\"
class=\"style8\">Thu<\/div><\/th>
<th height=\"27\" scope=\"col\"><div align=\"center\"
class=\"style8\">Fri<\/div><\/th>
<th height=\"27\" scope=\"col\"><div align=\"center\"
class=\"style8\">Sat<\/div><\/th>
<\/tr>" }
sub up_from_zero {
week_day_blank;
$mystart++;
$ia++;
}
sub week_start_sunday {
if (($i == 1) && ($mystart == 1)) {
print "
<td width=\"27\" height=\"27\"><div align=\"center\"
class=\"style4\">$mystart<\/div><\/td>" }
if (($i == 8) && ($mystart >= 8)) {
print "
<td width=\"27\" height=\"27\"><div align=\"center\"
class=\"style4\">$mystart<\/div><\/td>" }
if (($i == 15) && ($mystart >= 15)) {
print "
<td width=\"27\" height=\"27\"><div align=\"center\"
class=\"style4\">$mystart<\/div><\/td>" }
if (($i == 22) && ($mystart >= 22)) {
print "
<td width=\"27\" height=\"27\"><div align=\"center\"
class=\"style4\">$mystart<\/div><\/td>" }
if (($i == 29) && ($mystart <= 29)) {
print "
<td width=\"27\" height=\"27\"><div align=\"center\"
class=\"style4\">$mystart<\/div><\/td>" }
if (($i == 36) && ($mystart == 31)) {
print "
<td width=\"27\" height=\"27\"><div align=\"center\"
class=\"style4\">$mystart<\/div><\/td>" }
}
############# hashed out as totally wrong.
#sub week_day {
# if (($i = 2..7) && ($mystart = 1..31)) ||
# (($i = 9..14) && ($mystart = 1..31)) ||
# (($i = 16..21) && ($mystart = 1..31)) ||
# (($i = 23..28) && ($mystart = 1..31)) ||
# (($i = 30..31) && ($mystart = 1..31)) {
# print "
# <td width=\"27\" height=\"27\"><div align=\"center\"
>$mystart<\/div><\/td>" }
#}
sub week_day_blank {
print "<td width=\"27\" height=\"27\"><div align=\"center\"
><\/div><\/td>"
}
sub week_end_saturday {
if ($i == 7) { print "
<\/tr><tr>" }
if ($i == 14) { print "
<\/tr><tr>" }
if ($i == 21) { print "
<\/tr><tr>" }
if ($i == 28) { print "
<\/tr><tr>" }
if ($i == 35) { print "
<\/tr><tr>" }
if ($i == 42) { print "
<\/tr>" }
}
sub week_end_blank {
if (($i >= 36) && ($i >= 42)) {
week_day_blank;
}
}
sub footer {
print "
# <\/table><\/td>
# <\/tr>
#<\/table>
<\/body>
<\/html>"
}
sub leading_stuff {
print "
<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN\"
\"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd\">
<html xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">
<head>
<title>testing<\/title>
<style type=\"text\/css\">
<!--
#Layer1 {
position:absolute;
left:39px;
top:36px;
width:132px;
height:167px;
z-index:1;
}
.style1 {color: #000000}
.style4 {color: #FF3300; }
body {
background-color: #003399;
}
.style5 {
font-size: 36px;
color: #FFFFFF;
}
.style6 {color: #FFFFFF}
.style7 {color: #FF3300; font-size: 12px; }
.style8 {font-size: 12px}
.style9 {font-size: 24px}
-->
<\/style>
<\/head>
<body>
<table width=\"10%\" height=\"287\" border=\"0\" align=\"left\"
cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td align=\"left\"><form
action=\"http:\/\/www.absey-vine.co.uk\/calendar\/testing123\/\"
method=\"get\" enctype=\"text\/plain\" name=\"year\" id=\"year\">
<p align=\"centre\" class=\"style1 style6\">
<label>
<input name=\"language\" type=\"radio\" value=\"en\"
checked=\"checked\" \/>
<span class=\"style6\">English<\/span><\/label>
<br \/>
<\/p>
<\/form><\/td>
<\/tr>
<\/table>"
}
}
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/