Page 1 of 1

calling functions in php

Posted: Wed Oct 30, 2002 11:17 am
by jamal
Hi Guys,
this is my class of style below. I used this file as html_class.inc.
No my problem is how can I call the function Style() and function Body() in my index.php to perform their function??
Please here is my code.
<?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() {
echo "<body bgcolor=\"{$this->bgcol}\" text=\"{$this->text}\" link=\"{$this->link}\" vlink=\"{$this->vlink}\" alink=\"{$this->alink}\">\n <font face=\"{$this->face}\" size=\"{$this->size}\">\n";
}

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

}
}

?>

Posted: Wed Oct 30, 2002 11:18 am
by volka

Code: Select all

$oStyle = new Style;
$oStyle-&gt;Style();
$oStyle-&gt;body();
http://www.php.net/manual/en/language.oop.php