<?php
require_once("htmlist.php");
//Prepare some HTML content
$ul = array(
"<ul>",
array(
"<li>One</li>",
"<li>Two</li>",
"<li>Three</li>"
),
"</ul>"
);
//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 {",
array(
"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);
//Debug:
//print_r($a);
//Final output
$a -> str(true);
/*
<style>
div {
background: #ff0080;
}
</style>
<span>As easy as:</span><br />
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>
<div>
<i>This goes after everything else.</i>
</div>
*/
?>
|