Page 1 of 1

HTML Classes

Posted: Sat Oct 26, 2002 7:53 pm
by jamal
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]

Posted: Sun Oct 27, 2002 1:37 am
by Takuma
What's wrong with this code?

Posted: Sun Oct 27, 2002 1:01 pm
by Porter
I feel real dumb for not noticing you posted a few of these topics but anyways. This should help you out a bit, you had some extra braces.

Code: Select all

&lt;?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-&gt;text=$text; 
		$this-&gt;alink=$alink; 
		$this-&gt;vlink=$vlink; 
		$this-&gt;link=$link; 
		$this-&gt;bgcol=$bgcol; 
		$this-&gt;face=$face; 
		$this-&gt;size=$size; 
		$this-&gt;align=$align; 
		$this-&gt;valign=$valign; 
	} 

	function Body() { 
		echo "&lt;body bgcolor="{$this-&gt;bgcol}" text="{$this-&gt;text}" link="{$this-&gt;link}" vlink="{$this-&gt;vlink}" alink="{$this-&gt;alink}"&gt;\n &lt;font face="{$this-&gt;face}" size="{$this-&gt;size}"&gt;\n"; 
	} 

	function TextOut($message="&amp;nbsp")
	{ 
		echo "&lt;font face="{$this-&gt;face}" size="{$this-&gt;size}" color="{$this-&gt;text}"&gt;{$message}&lt;/font&gt;\n"; 

	}
}

?&gt;

Posted: Sun Oct 27, 2002 2:50 pm
by twigletmac
Hi, I'm locking this thread because there are now three which deal with the same problem and it's getting very confused and spread out. For those wishing to help please post here:
http://www.devnetwork.net/forums/viewtopic.php?t=3900

Mac