The only object-oriented programming experience I have is C #, so PHP throws me some crooked balls that I could use.
I have a class that I use for all my pages, "pagebase", if you do. It processes the lowest level html structure. This class is inherited by several other classes. These classes are different types of pages that are on the site. Now: it's hard for me to set the variable to "pagebase" from an instance of the class that inherits it. In C #, that won't be a problem, since the class instance behaves as if it were an inherited class.
This is a view of what I have:
pagebase.php
<?php
class pagebase
{
var $title = "No title";
var $body = "<center>No content</center>";
function setTitle($value) {
$this->title = $value;
}
function setBody($value) {
$this->title = $value;
}
function updateHTML()
{
...
}
function drawPage()
{
$this->updateHTML();
echo $this->html;
}
}
?>
std_page.php
<?php
include("includes/pagebase.php");
class std_page extends pagebase
{
function std_page()
{
...
}
function updateHTML()
{
parent::setBody(
"
<div id=\"main_wrapper\">
The page goes here!
</div>
"
);
}
function drawPage()
{
$this->updateHTML();
parent::drawPage();
}
}
?>
index.php
<?php
include "includes/std_page.php";
$page = new std_page;
$page->setTitle("Avesta");
$page->drawPage();
?>
, , , . , , , , .
-, , , -