class Page {
var $Title;
var $Keywords;
var $Content;
function Display( ) {
echo "\n\n";
$this->DisplayTitle( );
$this->DisplayKeywords( );
echo "\n\n\n";
echo $this->Content;
echo "\n\n\n";
}
function DisplayTitle( ) {
echo "<title>" . $this->Title . "</title>\n";
}
function DisplayKeywords( ) {
echo '<meta name="keywords" content="">. $this->Keywords . '">';
}
function SetContent( $Data ) {
$this->Content = $Data;
}
}
VAR -
All variables declared in the class must be placed at the top of the class structure, and preceeded with the VAR statement.
$THIS -
$this is a variable that incidates the current object. That way, the object knows how to find itself while running functions contained within it.
For instance, $this->Keywords gets the data from the $Keywords variable in the object. You'll also notice that when using variables contained
within a class, you can't use the $ to reference them - But you have to use it to reference the object itself.
ดีไซน์ก็เก๋ พีเอชพีก็ได้ แถมภาษาอังกิดได้อีก !
ReplyDelete