PHP Classes

File: Usage

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Niels Nielsen  >  HTMList  >  Usage  >  Download  
File: Usage
Role: Example script
Content type: text/plain
Description: Shows the basic of using the HTMList
Class: HTMList
Create and manipulate HTML output programaticallly
Author: By
Last change:
Date: 5 years ago
Size: 1,190 bytes


Class file image Download
//Prepare some HTML content
$ul = array(
//Create a new list using the content array
$a = new HTMList($ul);
//Insert content at the beginning
$a -> add_before("<span>As easy as:</span><br />");
//Using labeled content
$a -> add_after(array("footnote"=>array("<i>This goes after everything else.</i>")));
//Add a div around "footnote" and call it wrapper
$a -> add_around("<div>", "</div>", "footnote", "wrapper");
//Prepare some CSS
$css = array(
"div {",
"background: #ff0080;"
//Make a new HTMList with it
$b = new HTMList();
$b -> add_css_before($css);
//Add the obj with the CSS to our first obj
$a -> add_before($b);
    //Final output
$a -> str(true);

            div {
                background: #ff0080;

        <span>As easy as:</span><br />
            <i>This goes after everything else.</i>