Zend - The PHP Company




HTML

Add Code


lists.php - part of the html.php library  

Type: code fragment
Added by: homechicken
Entered: 21/03/2000
Last modified: 08/12/1999
Rating: - (fewer than 3 votes)
Views: 6613
Simplifies outputting lists in php. Use in conjunction with html.php, forms.php, and tables.php.


<?php
    
/* lists.php3
     *
     * functions for creating html lists
     *
     * Refer HTML questions to http://www.w3.org/TR/REC-html40/
     */

    /* let other includes know we're here.. */
    
define("USING_LISTS""Yup");

    
/* begin function declaration */

    
function ul($args="") {
        
$temp "n<UL";
        if(
$args != "")
            
$temp .= $args";
        
$temp .= ">n";
        print(
$temp);
        
/* possible $args: class */
    
}

    function 
ul_close() {
        print(
"n</UL>n");
    }

    function 
ol($args="") {
        
$temp "n<OL";
        if(
$args != "")
            
$temp .= $args";
        
$temp .= ">n";
        print(
$temp);
        
/* possible $args: class */
    
}

    function 
ol_close() {
        print(
"n</OL>n");
    }

    function 
li($text=""$args="") {
        
$temp "t<LI";
        if(
$args != "")
            
$temp .= $args";
        
$temp .= ">";
        if(
$text != "")
            
$temp .= "$text</LI>n";
        print(
$temp);
        
/* possible $args: value */
    
}

    function 
li_close() {
        print(
"</LI>n");
        
/* not necessary, but here for compatibility and/or compliance */
    
}
?>    



Usage Example


<?
include("html.php");
include(
"lists.php");
doctype_transitional();
html();
head();
title("My title");
head_close();
body();
ul();
li("The first unordered list item");
li();
print(
"The second item.");
ul_close();
br(2);
ol();
li("The first ordered list item");
li("Item2");
ol_close();
body_close();
?>


Rate This Script





Search



This Category All Categories