HTML
|
|
|
|
<?
/* liststr.php
*
* functions for creating html lists
*
* Refer HTML questions to http://www.w3.org/TR/REC-html40/
*
* Returns string instead of printing output. Contains no formatting.
*/
if(defined("USING_LISTS")) {
function ul_str($args="") {
$temp = "<UL";
if($args != "")
$temp .= " $args";
$temp .= ">";
return($temp);
/* possible $args: class */
}
function ul_close_str() {
return("</UL>");
}
function ol_str($args="") {
$temp = "<OL";
if($args != "")
$temp .= " $args";
$temp .= ">";
return($temp);
/* possible $args: class */
}
function ol_close_str() {
return("</OL>");
}
function li_str($text="", $args="") {
$temp = "<LI";
if($args != "")
$temp .= " $args";
$temp .= ">";
if($text != "")
$temp .= "$text</LI>";
return($temp);
/* possible $args: value */
}
function li_close_str() {
return("</LI>");
/* not necessary, but here for compatibility and/or compliance */
}
} else {
function ul($args="") {
$temp = "<UL";
if($args != "")
$temp .= " $args";
$temp .= ">";
return($temp);
/* possible $args: class */
}
function ul_close() {
return("</UL>");
}
function ol($args="") {
$temp = "<OL";
if($args != "")
$temp .= " $args";
$temp .= ">";
return($temp);
/* possible $args: class */
}
function ol_close() {
return("</OL>");
}
function li($text="", $args="") {
$temp = "<LI";
if($args != "")
$temp .= " $args";
$temp .= ">";
if($text != "")
$temp .= "$text</LI>";
return($temp);
/* possible $args: value */
}
function li_close() {
return("</LI>");
/* not necessary, but here for compatibility and/or compliance */
}
} ?>
|
|
|
Usage Example
|
<?
include("includes/html.php");
include("includes/htmlstr.php");
include("includes/tablestr.php");
include("includes/lists.php");
include("includes/liststr.php");
include("includes/formstr.php");
doctype_transitional();
head();
title("This is a test");
head_close();
body();
h(1, "Sample Page", "center");
p();
print("The Tables:");
print(table(2, "95%", 0, 15));
printf("%s%srow1cell1n", tr(), td());
printf("%srow1cell2n", td());
printf("%s%srow2cell1n", tr(), td());
printf("%srow2cell2n", td());
print(table_close());
print(br_str(2));
print("The Lists:");
ul();
li("Unordered One");
printf("%sUnordered Twon", li_str());
li();
print("Unordered Three");
ul_close();
br(2);
print("The Forms:");
p();
$myform = form("process.php");
for($i=0; $i<5; $i++)
$myform .= input_text("field$i", 25, 50) . br_str();
$myform .= br_str(1) . center_str();
$myform .= input_submit() . input_reset() . center_close_str(). form_close();
print($myform);
print(body_close_str()); ?>
|
|
|
Rate This Script
|
|
|
|