PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Alf-Red   html.class.php   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: to test the tags
Class: html.class.php
Generate HTML document tags programatically
Author: By
Last change: Rewrite of the example page of the html.class.php
for a better understanding
Date: 18 years ago
Size: 3,299 bytes
 

Contents

Class file image Download
<?php

$text
= "New update done the 04-08-2005" ;

$text2 = "Hello world !!!!" ;

// all the functions are written to allowed you
// to use the html tag exactly as you can use it normaly
// Some tags are double....
//
// example with the tag <a href=''></a> for the links
//
// if you put a text for the link write it like this
// $page->A("./test.php", "links to click");
// the function will open AND close the tag
//
// if you need to use something else than a text
// do it by this way
// you use the astart to start the tag
// $page->AStart("./test.php");
// you can set up the image you want to use
// $page->Image("./img.jpg", 100, 100, 0, "image de test");
// and then you have to close the tag with the aend function
// $page->AEnd();


// A good thing to do is to use an editor like Zend studio, or phped
// and first of all juste open the html.class.php in you editor
// then you will be able to use you class without rewriting all the function
// with the class includer


//include the class page
require("./html.class.php") ;

//define the var to use the class
$page = new HTML() ;

// to make this example align in the center of the page
$page->Div("center");


// starting to draw a <table>
$page->TblStart(1, 400, 450, 0, 0, -1, -1);

// define the start of the line of the table
$page->TblStartLine("center", -1, -1, -1);

// define the start of the cell
$page->TblStartCell(200, 150, -1, "center", -1, -1, -1);

// put some text in it
$page->P("Hello world !!!!", -1);

// define the end of the cell
$page->TblEndCell();

// define a cell in only one function
$page->TblCell("Hello world !!!!", 200, 150, -1, "center", -1, -1, -1);

// close the line
$page->TblEndLine();

// start of the second line

// you do not need to write the unused parameter in the function at the end of it...
// $page->TblStartCell(200, 150, -1, \"center\", -1, -1, -1);
// you do not need to write the last three -1 like this
// $page->TblStartCell(200, 150, -1, \"center\");
// it will be -1 by default, if it is not set

$page->TblStartLine("center");
$page->TblStartCell(200, 150, -1, "center");

// to write the text in bold
$page->Bold($text2);

$page->TblEndCell();
$page->TblStartCell(200, 150, -1, "center");

// to write the text in italique
$page->I($text2);

$page->TblEndCell();
$page->TblEndLine();



// start of the third line
$page->TblStartLine("center");

// define the start of the cell
$page->TblStartCell(200, 150, -1, "center");

// give a color and a font for the text
$page->Font($text2, "Arial", "red", 3);

// define the end of the cell
$page->TblEndCell();

// define the start of the cell
$page->TblStartCell(200, 150, -1, "center");

// give a color and a font for the text with the second
// because maybe you want to put the text in bold or italique
$page->FontStart("Arial", "blue", 3);
// write the text
$page->Bold($text2);
// and then close the font tag
$page->FontEnd();
// define the end of the cell
$page->TblEndCell();

// close the line
$page->TblEndLine();


// define the end of the <table> tag
$page->TblEnd();


$page->Br(2);
$page->Bold($text);

// and then at the end you will have to close
// the div tag
$page->DivEnd();

?>