PHP Classes

File: Example

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Ruben Espadas  >  Another HTML Generator  >  Example  >  Download  
File: Example
Role: Example script
Content type: text/plain
Description: Some examples for the use of the class
Class: Another HTML Generator
Compose HTML forms programmatically
Author: By
Last change: - Add a new examples
Date: 6 years ago
Size: 1,775 bytes


Class file image Download
$html = new getHTML();

// For a common DOM element creation a simple syntax can generate it.
// Syntax: $html->genHTML(<type tag>, <element name>, <element id(optional parameter)>, <element value(optional parameter)>, <element class(optional parameter)>, <element label(optional parameter)>);

$html->img = 'logo.jpg';
$html->genHTML('img', 'logoImg', '', '', '', '');
$html->methodform = 'post';
$html->actionform = '#';
$html->endLine = '<br />';
$html->genHTML('iniform', 'login', '', '', '', '');
$html->genHTML('text', 'user', 'user', 'Write your username here', 'inputcss', 'user');
$html->genHTML('pass', 'pass', 'pass', '', 'inputcss', 'pass');

// A line start or end
$html->startLine = "<span style='margin-left: 20px;'>";
$html->endLine = '</span><br />';
$html->genHTML('radio', 'departament', 'HARDWARE', 'hardware', '', 'HARDWARE');
$html->genHTML('radio', 'departament', 'SOFTWARE', 'software', '', 'SOFTWARE');
// If yo want an event, you have an event
$html->event = 'click';
$html->method = 'alert(\'This department is being monitored for security reasons\')';
$html->genHTML('radio', 'departament', 'ADMINISTRATION', 'administration', '', 'ADMINISTRATION');
// The vars event and method only operate for the element immediately following

$html->genHTML('submit', 'submit', '', 'LOGIN', 'buttoncss', '');
$html->genHTML('endform', '', '', '', '', '');

// Some JS actions...
$html->jsAlert('This is a classic HELLO WORLD!');
$html->jsPopUp('popuppage.html', '400px', '400px');

// And another help for creation, for example a select list
$texts = array('PEAR', 'APPLE', 'BANANA');
$vals = array('man','giraffe','monkey');
$html->genList($vals, $texts, 'animals and fruits', '', '');