PHP Classes

PHP HTML Generator Library with jQuery Support: Generate HTML with jQuery function call support

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 166 All time: 8,899 This week: 57Up
Version License PHP version Categories
jquery 1.0.3Freeware5HTML, PHP 5
Description 

Author

This package can generate HTML with jQuery function call support.

The main class provides a function call handler ( __call ) that can determine the name of the HTML tag to add to a page from the function name that developers use in the code that calls the class.

This allows the package to add any HTML tag to the page with less class code.

The package also provides a class to add JavaScript code that calls the jQuery library functions.

Innovation Award
PHP Programming Innovation award nominee
April 2023
Number 3
All sites served using PHP need to output HTML. One way to output that HTML code using PHP is to compose and generate the HTML from parameters that define details of the HTML tags that developers need to develop to manage the page output.

This package provides a class to generate HTML tags and JavaScript code to call the jQuery library.

The class uses the PHP __call handler to allow the addition of any HTML tag or jQuery function library call to the current page output.

This way, the code of these classes is minimal, as they do not need to have many functions to support all HTML tags or jQuery functions.

Manuel Lemos
Picture of Kashif Rafi
  Performance   Level  
Innovation award
Innovation award
Nominee: 1x

 

Example

<?php
//Usage example of jQuery and HtmlCode classes
include 'jQuery.php';
include
'HtmlCode.php';

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

$htm->head_start();
$htm->title_start()->contents('Web Page Title')->title_end();
$htm->script_start(array('src'=>'https://code.jquery.com/jquery-3.4.1.min.js'))->script_end();
$htm->head_end();
$htm->body_start();
$htm->div_start(array('class'=>'testDivClass','id'=>'testDiv','styleSelector'=>'.testDivClass','style'=>array(
   
'width'=>'500px',
   
'padding'=>'20px',
   
'border'=>'1px solid #000',
   
'margin'=>'50px auto'
)));
$htm->p_start();
$htm->contents('Some paragraph content here');
$htm->p_end();
$htm->div_end();
$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();
$htm->body_end();
echo
$htm->output();


  Files folder image Files (5)  
File Role Description
Accessible without login Plain text file fromjson.php Example generating html code from json
Plain text file HtmlCode.php Class generates html code in php
Accessible without login Plain text file index.php Example usage examples of jquery and htmlcode php classes
Plain text file jQuery.php Class generates jquery code
Accessible without login Plain text file jsoncode.json Conf. list of html tags in json format

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:166
This week:0
All time:8,899
This week:57Up