Login   Register  
PHP Classes
elePHPant
Icontem

File: php/data.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Roberts  >  OnHTML  >  php/data.php  >  Download  
File: php/data.php
Role: Example script
Content type: text/plain
Description: Unit test script
Class: OnHTML
Generate a HTML page to be shown with JavaScript
Author: By
Last change:
Date: 2 years ago
Size: 947 bytes
 

Contents

Class file image Download
<?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);