PHPBuilder - PHP Layout Class Page 3



RSS Twitter
Articles Html

PHP Layout Class - Page 3

by: Robbin Zhang
|
July 30, 2000

People will ask questions like this: It doesn't seem to simplify the job, perhaps requiring even more typing? That is true for a 10 line web page but definitly NOT for a 500 line web page. The benefits are not limited to this only. Any complex web site uses tables, forms, frames extensively and most of them are nested in each other. Creating these kinds of pages is really a challenge if you are not using class.layout.
Enough talking about the design. Let's start with a simple web page.

<?php
    newhtml
($w);
    
insert($w,wheader("A Test Page"));
    
insert($w,$t table(array("cols"=>"2","width"=>"650")));
    
insert($t,$c cell(array("colspan"=>"2")));
    
insert($c,text("TEST ONLY"));
    
printhtml($w);
?>
The function 'newhtml' starts a container with a pair of HTML tags <HTML> and </HTML>. It is the parent of all other containers thereafter. function 'wheader' (avoid conflicts with built-in function 'header') creates a pair of <HEAD>,</HEAD> and contains '<TITLE>A Test Page</TITLE>'. A table is created and is inserted into the window container with another 'insert'. Once all the construction is finished, 'printhtml' prints the results right away.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
    <TITLE>A Test Page</TITLE>
</HEAD>
<BODY>
     <TABLE WIDTH="650">
     <TR>
    <TD COLSPAN="2"><FONT>TEST ONLY</FONT></TD>
     </TR>
     </TABLE>
</BODY>
</HTML>

« Previous Page
1
|
2
|
3
|
4
|
5
|
6
|
7
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Robbin Zhang

Comment:



Comment:

(Maximum characters: 1200). You have characters left.