PHP Classes

File: example1.php

Recommend this page to a friend!
  Classes of shrawan  >  HTML and XML builder  >  example1.php  >  Download  
File: example1.php
Role: Example script
Content type: text/plain
Description: example
Class: HTML and XML builder
Compose HTML and XML documents programmatically
Author: By
Last change:
Date: 12 years ago
Size: 2,734 bytes


Class file image Download

/*remember every opening tag must have a closing tag
     *closing a tag with close(), points to the previous tag
     * */
    /*remove the comment to view as xml*/
$html=new html('html');
head->title->text('HTML Example')->close()/*close titlr*/
->close();/*close head*/

->div->style('font-size:50px;')->text('I AM DIV')->close()/*close div*/
->div->id('formHolder')->close()/*close div*/
->div->class('formHolder')->close()/*close div*/
->div->title('titlename')->close();/*close div*/
$html->h1->id('h1')->style('color:red;')->text('I AM H1')->close();
$form=new html('form');
/*to check the example remove the comment one by one*/
    /* search for tag
     * find ([tagname])
     * */

    /* search for id
     * find (#[idName])
     * */
    /* search for class
     * find (.[className])
     * */
    /* search for any other attributes
     * find (&[attributeName])
     * */
     * search with attribute value
     * find('attributeName','attributeValue')
     * insert(object,true or false(by default false))
     * true means insert the object befor the current tag gets closed
     * false (which is default) inserts just after the current tag

     * if find doesn't find any matches it will point to the current tag
$html->find('h1')->text(null)/*clears the text for current tag*/
->text('I m new Text')/*again set the new text*/
->style(null)/*deletes the attribute with name style*/
->id(null)/*deletes the attribute with name id*/
->id('newH1')/*again set the new attribute id*/
->style('color:blue;') /*again set the color to blue for h1*/
->clearAttribute('style')/*clear style attribute values*/
->alterTag('H6') /*chage the tag name h1 to h6*/

For more information send a message to info at phpclasses dot org.