The following is simply a cool way to show a date.
Cut/paste as you neeed, but the code will run "as-is"
I have used the css ID "mydate" to position the date
display as needed. Move as you may.
To see a working example, please review:
http://www.xn--ovg.com/kewl_date
tedd
--- copy below "as-is" ----
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
<title>Stuff by tedd</title>
<style type="text/css">
#mydate
{
position: absolute;
top: 10em;
left: 10em;
}
table.date
{
font-size: small; /*1em; */
font-family: verdana, arial, helvetica, sans-serif;
margin:auto;
}
table.date th
{
font-weight:normal;
text-align:center;
}
table.date th.day
{
padding-right:0.5em;
}
table.date th.month
{
padding:0.5em;
}
table.date td
{
vertical-align:top;
text-align:center;
background:#CAD6E2;
padding:0.4em;
}
</style>
</head>
<body>
<h1>tedd's kewl date</h1>
<?php
$date = date ( 'Y\-\ m\-\ d' );
$date = str_replace ( " " , "" , $date );
echo( "Date: " . $date . "<br/>" );
?>
<div id="mydate">
<table class="date" cellspacing="2" cellpadding="0">
<tr>
<th></th>
<?php
for ( $i = 1 ; $i <= 12 ; $i ++)
{
echo( "<th class=\"month\">" . date ( "M" , mktime ( 0 , 0 , 0 , $i + 1 , 0 , 0 )));
}
?>
</tr>
<tr>
<th class="day">
<?php
echo( date ( 'Y' ) . "</th>" );
for ( $i = 1 ; $i <= 12 ; $i ++)
{
echo( "<td>" );
if( date ( 'm' ) == $i )
{
echo( date ( 'j' ));
}
echo( "</td>" );
}
?>
</tr>
</table>
</div>
</body>
</html>
Simple PHP control CSS Calendar Categories : PHP , HTML and PHP , Calendar , Date Time , CSS Find if a year is leap. Categories : PHP , Date Time , Beginner Guides , Data Validation Count Number Of weeks in Month Categories : PHP , Date Time , Beginner Guides How to Create a Shoutbox Using PHP & MySQL Categories : PHP , MySQL , Web Applications , Beginner Guides , HTML and PHP Newbie Notes #9 - Hyperlinking a post Categories : PHP , Java Script , HTML and PHP , Beginner Guides Dynamic CSS generation for multiple website colouring schemes. Categories : PHP , CSS , HTML and PHP Simple Javascript CSS Digital Clock Categories : Java Script , Date Time , CSS , Beginner Guides , Web Design PHP based HTML rabbing Tools Categories : PHP , HTML and PHP , Tag Extractors , Regexps , Beginner Guides If you want to create select buttons featuring current date this example will show you how... Categories : Date Time , HTML and PHP , PHP Creates three SELECT form fields: Month, Day, and Year. You give it a string which will be used to make the name for the three fields, and a number of seconds to use as the default date. If you give it blank for this value, the current date is used. Categories : HTML and PHP , PHP , Date Time How to preset a text string in a textarea input field Categories : HTML , HTML and PHP , PHP , Beginner Guides CSS style switcher Categories : PHP , CSS , HTML and PHP , Arrays , Sessions Using PHP im HTML image tags Categories : PHP , HTML and PHP , Graphics , Beginner Guides PHP alternating the colors of table rows with style. Categories : PHP , HTML and PHP , CSS Customizable Calendar Class Categories : HTML and PHP , Date Time , PHP , PHP Classes , Calendar
Ioannis Cherouvim wrote : 1629
Try refactoring your code using some http://www.weberdev.com/for loops.