<?php 
 
require('onhtml.class.php'); 
 
// Since PHP 5.4 
// $html = new OnHTML(null,'div')->attr('class','main')->attr('data-demo','demo'); 
 
// Compatible 
$html = new OnHTML(null); 
// Set $html class to main and attribute data-demo to demo. Attr is jQuery.attr compatible. 
$html->attr('class','main')->attr('data-demo','demo'); 
// Set some css. Css is jQuery.css compatible. 
$html->css('padding','10px')->css('border','1px solid red'); 
 
// Lets create a new sub element of $html 
$other = $html->addElement(null,'ul')->addClass('aaa','bbb','ccc'); 
$other->removeClass('ccc'); 
// Some sub element generation 
for($i = 0;$i<=100; $i++){ 
    $other->addElement('test','li')->attr('id','someid_'.$i)->attr('class','myclass');     
} 
 
// And we output the result. 
 
echo $html->json(); 
 
 
 
 
// Request log. 
// ob_start(); 
// print_r($_GET); 
// $log = date('H:i:s').':'.PHP_EOL.ob_get_clean().PHP_EOL.PHP_EOL; 
// file_put_contents('request_log.txt',$log,FILE_APPEND);
 
 |