PHPBuilder - PHP Layout Class Page 2



RSS Twitter
Articles Html

PHP Layout Class - Page 2

by: Robbin Zhang
|
July 30, 2000

An entire complex web site or application can be written with a bunch of 'insert's. The design of class.layout comes from the fact that most of the HTML tags are in pairs and like a container with lots of attributes. Look here:
	<A HREF="/index.html">Homepage</A>
<A> and </A> is a pair and 'HREF="/index.html"' are the attributes of the tag <A>. A simple Anchor object would be:

<?php
class Anchor {
    var 
$source "";
    var 
$attributes = array();
    
    function 
Anchor ($s,$a) {
        
$this->source $s;
        
$this->attributes $a;
    }

    function 
printit() {
        echo 
"<A ";
        while(list(
$key,$val) = each($this->attributes)) {
            echo 
"$key =\"$val\" ";
        }
        echo 
">"
        echo 
$this->source ; echo "</A>";
    }
}
?>
Now you can create the:
	<A HREF="/index.html">Homepage</A>

with the following code lines:

<?php
    $a 
= new Anchor("/index.html",array("href" => "Homepage"));
    
$a->printit;
?>

« 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.