PHP Classes

File: example2.php

Recommend this page to a friend!
  Classes of shrawan   HTML and XML builder   example2.php   Download  
File: example2.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: 14 years ago
Size: 3,033 bytes
 

Contents

Class file image Download
<?php
   
include('XHBuilder.php');

   
/*remove the comment to view as XML*/
    //header('Content-type:text/xml');
   

   
$table=new html('TABLE ');
        
        
$table->style('font-family:arial;font-weight:bold;')
             ->
th->id('oops')->style('border:2px solid red')->text('Name')
                 ->
span->label->close()->close()
             ->
close()
             ->
th->id('th')->style('border:2px solid red')->text('Name')->close()
             ->
th->style('border:2px solid red')->text('Address')->close()
             ->
th->style('border:2px solid red')->text('Age')->close()
             ->
th->id('th')->style('border:2px solid red')->text('Sex')->close();
        
        
$table->tr->style('font-weight:normal;border:1px solid green;')
                 ->
td->style('border:1px solid green;')->text('1')->close()
                 ->
td->style('border:1px solid green;')->text('Shrawan Adhikari')->close()
                 ->
td->style('border:1px solid green;')->text('Kathmandu,Nepal')->close()
                 ->
td->style('border:1px solid green;')->text('24')->close()
                 ->
td->style('border:1px solid green;')->text('Male')->close()
                ->
close();

        
$table->tr->style('font-weight:normal;border:1px solid green;')
                 ->
td->style('border:1px solid green;')->text('2')->close()
                 ->
td->style('border:1px solid green;')->text('Pawan Adhikari')->close()
                 ->
td->style('border:1px solid green;')->text('Jhapa,Nepal')->close()
                 ->
td->style('border:1px solid green;')->text('25')->close()
                 ->
td->style('border:1px solid green;')->text('Male')->close()
                ->
close();

        
$table->tr->style('font-weight:normal;border:1px solid green;')
                 ->
td->style('border:1px solid green;')->text('3')->close()
                 ->
td->style('border:1px solid green;')->text('Prakash Subedi')->close()
                 ->
td->style('border:1px solid green;')->text('Kathmandu,Nepal')->close()
                 ->
td->style('border:1px solid green;')->text('21')->close()
                 ->
td->style('border:1px solid green;')->text('Male')->close()
                ->
close();
               
        
$table->tr->style('font-weight:normal;border:1px solid green;')
                 ->
td->style('border:1px solid green;')->text('3')->close()
                 ->
td->style('border:1px solid green;')->text('Shristi Karanjit')->close()
                 ->
td->style('border:1px solid green;')->text('Kathmandu,Nepal')->close()
                 ->
td->style('border:1px solid green;')->text('21')->close()
                 ->
td->id('insertHere')->style('border:1px solid green;')->text('Female')->close()
                ->
close()
         ;
        
   
   
$tr=new html('tr');
       
$tr->style('font-weight:normal;border:1px solid gray;')
                 ->
td->style('border:2px solid blue;')->text('1')->close()
                 ->
td->style('border:2px solid blue;')->text('Ashish Amatya')->close()
                 ->
td->style('border:2px solid blue;')->text('Kathmandu,Nepal')->close()
                 ->
td->style('border:2px solid blue;')->text('21')->close()
                 ->
td->style('border:2px solid blue;')->text('Male')->close()
                ->
close() ;
   
   
   
$table->find('#insertHere')->insert($tr);

   
$table->find('table')->insert($tr)->insert($tr,true);
   
    echo
$table;
        
?>