webElements is a PHP library that generates XHTML code using a simple syntax, accelerating the process of writing complex websites.
All functions have the name of the xhtml element:
h1(), h2(), p(), img(), a(), em(), ul(), div(), form(), table(), etc...
Generally they accept 2 parameters, value and attributes, for example:
echo h1('Hello', 'id=heading1');
//will generate: <h1 id="heading1">Hello</h1>
The attribute parameter can be a string or an array. When using the string format, separate each attribute name from the value with a '=' and with a '&' each key/value pairs:
$attrs = 'href=www.url.com&title=go to url&class=link';
or if it is an array,
assign the name as the key and the value as value:
$attrs = array('href'=>'www.url.com', 'title'=>'go to url', 'class'=>'link');
For elements with native child nodes, such as lists, the call is for an object:
$ul = new ul(); then add the child elements:
$ul->add_li('List item'); and to output call:
$ul->get_html();.
A more complex example of this would be:
$fruits = array('apple', 'orange', 'mango', 'banana');
// create the list
$ul = new ul('id=fruits');
foreach($fruits as $fruit)$ul->add_li($fruit);
echo $ul->get_html();
will output:
<ul id="fruits">
<li>apple</li>
<li>orange</li>
<li>mango</li>
<li>banana</li>
</ul>
Contact for more information.
latest version:
webElements.php