objects and Classes
Hi,
Please I wondered if anyone could give me a starter on how to write a template of my html body using the object-oriented programming in php. There are the pieces of code below in which I copied from a site. But i could not get my way around them to make a fully useful code.
What i am trying to do with be clear to the professionals out there. Please kindly show me a complete example to start with.
Thanks.
Mojam
<?php
class Style {
var $text;
var $alink;
var $vlink;
var $link;
var $bgcol;
var $face;
var $size;
var $align;
var $valign;
}
?>
<?php
class Style {
function Style ($text="#000000",$alink="#AA00AA",
$vlink="#AA00AA",$link="#3333FF",
$bgcol="#999999",$face="Book Antiqua",$size=3,$align="CENTER",$valign="TOP") {
$this->text=$text;
$this->alink=$alink;
$this->vlink=$vlink;
$this->link=$link;
$this->bgcol=$bgcol;
$this->face=$face;
$this->size=$size;
$this->align=$align;
$this->valign=$valign;
}
}
?>
<?php $Basic = new Style; ?>
<?php
Function Set($varname,$value) {
$this->$varname=$value;
}
?>
<?php
function Body() {
PRINT "<BODY BGCOLOR=\"$this->bgcol\" ".
"TEXT=\"$this->text\" ".
"LINK=\"$this->link\" VLINK=\"$this->vlink\" ".
"ALINK=\"$this->alink\"><FONT ".
"FACE=\"$this->face\" SIZE=$this->size>\n";
}
?>
<?php $Basic->Body(); ?>
<?php
function TextOut($message=" ") {
PRINT "<FONT FACE=\"$this->face\" ".
"SIZE=$this->size COLOR=\"$this-> ".
"text\">$message</FONT>\n";
}
?>
___________________
:hmm
