#native_company# #native_desc#

PHP Layout Class Page 3

By Robbin Zhang
on 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.



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"));



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.




    <TITLE>A Test Page</TITLE>



     <TABLE WIDTH="650">