|
|
|
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 Calender Categories : PHP, HTML and PHP, Calendar, Date Time, CSS | | | XDT Topsite (Gold v1.0) Categories : Databases, CSS, PHP, HTML and PHP, Sessions | | | 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 alternating the colors of table rows with style. Categories : PHP, HTML and PHP, CSS | | | 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 | | | Newbie Notes #1 - Making a form return to itself Categories : PHP, Beginner Guides, HTML and PHP | | | Website colour changer Categories : PHP, HTML and PHP, Date Time | | | CALENDAR - easy calendar-navigation with PHP Categories : PHP, Date Time, HTML and PHP, Calendar | | | Form Submission Using Array's Categories : PHP, HTML and PHP, Beginner Guides, Arrays | | | Simple PHP Form Field Generator Categories : PHP, Beginner Guides, Form Processing, HTML and PHP | | | How to preset a text string in a textarea input field Categories : HTML, HTML and PHP, PHP, Beginner Guides | | | This script contains 2 functions: 1 to create html select object based on your own customer date format entry- "M d Y h:i.... etc". The second function processes the select object on submit back to unix time. Categories : PHP, Calendar, Date Time, HTML and PHP | | | Multiple Select box, Select multiple Items from Menu.List box Categories : PHP, HTML and PHP, Beginner Guides | |
| | | | Ioannis Cherouvim wrote :1629
Try refactoring your code using some http://www.weberdev.com/for loops.
| |
|
|
|