PHP Classes

File: try_it_yourself.php

Recommend this page to a friend!
  Classes of Pierre Papagato   HTML Classes   try_it_yourself.php   Download  
File: try_it_yourself.php
Role: Example script
Content type: text/plain
Description: Demo
Class: HTML Classes
Generate HTML documents programmatically
Author: By
Last change:
Date: 17 years ago
Size: 2,085 bytes
 

Contents

Class file image Download
<?
# -----------The PloucNet® Project - Copyright© LOGIQ Systèmes 2003-2007

// Exemple usage of phpclasses.htmlelements.php

  
include_once("aaa/classes/phpclasses.htmlelements.php");

  
$head = new clHtmlhead();
  
$body = new clHtmlbody();

  
$head->Content .= '<link rel="stylesheet" type="text/css" href="aaa/classes/exstyle.css">';
// create span
  
$x = new clHtmlSpan();
  
$x->Content = "Hello World";
  
$x->AddParameter("style","color:red;");

// Output result
  
$body->Content = $x->GenerateHtml();

// create absolute Div
  
$x = new clHtmlDiv("","","cellstyle");
  
$x->Content = "Hello World";
  
$x->AddParameter("style","color:blue;position:absolute;left:100px;top:100px");

// Output result
  
$body->Content .= $x->GenerateHtml();

// create "3x3" Table
  
$x = new clHtmlTable("","","");
  
$x->AddParameter("border","2");
  
$row = $x->AddRow();
  
$cell = $row->AddCell();
  
$cell->Content = "Cell 1x1";
  
$cell = $row->AddCell();
  
$cell->Content = "Cell 1x2";
  
$cell = $row->AddCell();
  
$cell->Content = "Cell 1x3";
  
$row = $x->AddRow();
  
$cell = $row->AddCell();
  
$cell->Content = "Cell 2x1";
  
$cell = $row->AddCell();
  
$cell->Content = "Cell 2x2";
  
$cell = $row->AddCell();
  
$cell->Content = "Cell 2x3";
  
$row = $x->AddRow();
  
$cell = $row->AddCell();
  
$cell->Content = "Cell 3x1";
  
$cell = $row->AddCell();
  
$cell->Content = "Cell 3x2";
  
$cell = $row->AddCell();
  
$cell->AddParameter("width","300px");
  
$cell->AddParameter("align","center");

// Add a form in cell 3x3
  
$y = new clHtmlForm("fomrname","action.php");
  
$z = new clHtmlLabel();
  
$y->Content .= "Input your Data : ";
  
$z = new clHtmlInput();
  
$y->Content .= $z->GenerateHtml();

  
$z = new clHtmlInput();
  
$z->AddParameter("type","submit");
  
$y->Content .= $z->GenerateHtml();

  
$cell->Content = $y->GenerateHtml();

// Output result
  
$body->Content .= $x->GenerateHtml();

// Output Global result
  
print $head->GenerateHtml();
   print
$body->GenerateHtml();
?>