PHP Classes

File: DateDDLGenerator_Example.php

Recommend this page to a friend!
  Classes of Ellery Leung   Date Drop Down List Generator   DateDDLGenerator_Example.php   Download  
File: DateDDLGenerator_Example.php
Role: Example script
Content type: text/plain
Description: Example
Class: Date Drop Down List Generator
Generate HTML form select inputs to pick dates
Author: By
Last change: A clear example on demonstrating the use of this class.
Date: 17 years ago
Size: 2,038 bytes
 

Contents

Class file image Download
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
<title>Untitled Document</title>
</head>

<body>
<?php
include("DateDDLGenerator.class.php");
$ddl = new DateDDLGenerator;

#Normal use
print "Normal use:<br/><br/>";
print
"The function of genYearDDL(): "; $ddl->genYearDDL();
print
"<br/>";
print
"The function of genMonthDDL(): "; $ddl->genMonthDDL();
print
"<br/>";
print
"The function of genDayDDL(): "; $ddl->genDayDDL();
print
"<br/>";

print
"<p>---------------------------------------------------------------------------------</p>";

#Set the drop down list to current date:
$ddl_now = new DateDDLGenerator;
$ddl_now->setToCurrentDay();
print
"Set the drop down list to current date - using setToCurrentDay()<br/><br/>";
print
"The function of genYearDDL() - with current date: "; $ddl_now->genYearDDL();
print
"<br/>";
print
"The function of genMonthDDL() - with current date: "; $ddl_now->genMonthDDL();
print
"<br/>";
print
"The function of genDayDDL() - with current date: "; $ddl_now->genDayDDL();
print
"<br/>";

print
"<p>---------------------------------------------------------------------------------</p>";

#Set the name of drop down list - you need to view the source of this file to see the effect:
$ddl_name_Change = new DateDDLGenerator;
$ddl_name_Change->setToCurrentDay();
print
"Set the drop down list to another name - using setToCurrentDay()<br/><br/>";
print
"The function of genYearDDL(\"NewYear\") - with current date: "; $ddl_name_Change->genYearDDL("NewYear");
print
"<br/>";
print
"The function of genMonthDDL(\"NewMonth\") - with current date: "; $ddl_name_Change->genMonthDDL("NewMonth");
print
"<br/>";
print
"The function of genDayDDL(\"NewDay\") - with current date: "; $ddl_name_Change->genDayDDL("NewDay");
print
"<br/>";

?>
</body>
</html>