Witam,
Mam dwie klasy Page i dekoruje ją Klasą Form
<?php
class Page{
public $pageOutput;
public function __construct() {
$this->pageOutput = $this->htmlHeader('Test');
}
/**
* Generating heading of html page
* @param $title String
* @return String
*/
public function htmlHeader($title){
$heading = ''
.\"\n\".''
.\"\n\".''
.\"\n\".''
.\"\n\t\".''
.\"\n\t\".''
.\"\n\t\".''
.\"\n\".'';
return $heading;
}
/**
* To put content all the together
* @param $content string
* @return void
*/
public function htmlContent($content) {
$this->pageOutput .= \"\n\".''.\"\n\";
$this->pageOutput .= $content;
$this->pageOutput .= $this->htmlFooter();
}
/**
* Closing Tags
* @return String
*/
public function htmlFooter(){
$footer .= \"\n\".''
.\"\n\".'';
return $footer;
}
}
?>
<?php
class Form {
public $page;
public function __construct(Page $page) {
$this->page = $page;
}
public static function htmlContent
() {
$this->page->pageOutput .= \"\n\".''.\"\n\";
$this->page->pageOutput.= 'Mask
Lenght
';
$this->page->pageOutput.= $this->page->htmlFooter();
}
}
?>
Teraz w htmlContent udekorowanym wyrzuca mi taki błąd:
Cytat
Fatal error: Using $this when not in object context in form.php on line 8
Nie wiem z czego wynika problem i błagam o pomoc.
Ten post edytował MMX3 18.03.2009, 09:26:11