PHP Classes

File: fromjson.php

Recommend this page to a friend!
  Classes of Kashif Rafi   PHP HTML Generator Library with jQuery Support   fromjson.php   Download  
File: fromjson.php
Role: Example script
Content type: text/plain
Description: generating html code from json
Class: PHP HTML Generator Library with jQuery Support
Generate HTML with jQuery function call support
Author: By
Last change:
Date: 1 year ago
Size: 683 bytes
 

Contents

Class file image Download
<?php
//Usage example of jQuery and HtmlCode classes
include 'jQuery.php';
include
'HtmlCode.php';

$jq = new jQuery("document");
$htm = new HtmlCode();

$jsonCode = json_decode(file_get_contents("jsoncode.json"),true);
$htm->parseJson($jsonCode);

$documentReady = function(){
   
$jq1 = new jQuery("'#testDiv'");
   
$jq1->find('p');
   
$jq1->css('color','blue');
   
$clickHandle = function(){
       
$jq2 = new jQuery("this");
        return
$jq2->css('color','red')->output();
    };
   
$jq1->on('click',$clickHandle);
    return
$jq1->output();
};
$scriptOutput = $jq->ready($documentReady)->output();
$htm->script_start()->contents($scriptOutput)->script_end();
echo
$htm->output();