calling functions in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jamal
Forum Commoner
Posts: 57
Joined: Sat Oct 26, 2002 7:53 pm
Location: London

calling functions in php

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

}
}

?>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Code: Select all

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