PDA

View Full Version : HTML_Class


jamal
10-27-2002, 01:02 AM
Hi,
Please i wondered if anyone out there could
just pity my life in php and do the correction for me??
I am just trying to get my kindergarten of php into
understanding of how to use an html_class in php.
Please do.
Thanks
Mo jam


[ php]
<?php

class Style {

var $text;
var $alink;
var $vlink;
var $link;
var $bgcol;
var $face;
var $size;
var $align;
var $valign;

}


function Style ($text="#CCCCFF",$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;

}

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

}

function TextOut($message="&nbsp") {

PRINT "<FONT FACE=\"$this->face\" ".
"SIZE=$this->size COLOR=\"$this-> ".
"text\">$message</FONT>\n";

}

?>
[ /php]

Ökii
10-27-2002, 07:27 AM
If that is all meant to become one class named style, you'll need to move the first } to the end.

class Name {

// set $vars
var $newvar;

// set functions
function newfunct() {
}

} <--- end of class brace - note that there isn't a brace after setting the vars.


Keep tinkering away and you'll get there :). Classes are pretty high on my list of things to learn too.,