
Ok do rzeczy mam taki kod class.temp.php:
<?php class new_template { private $sTemplate; // Szablon private $sReplacement; // Zamienniki public function __construct($rFile_name, $z, $na) { $this->file_name = $rFile_name ; $this->template = $sTemplate ; $this->replacement = $sReplacement ; $this->z = $z ; $this->na = $na ; } public function read() { { return true ; } $this->template = imlode("", $this->template); } public function add_replacement() { { $this->replacement[$this->z] = $this->na ; } } public function display() { $this->out = $this->templates ; foreach($this->replacement as $a => $b) { } return $this->out ; } } ?>
Oraz w index.php:
$szab = new new_template('templates/index.tpl', '{a}', $cos) ;
I wywala mi błąd związany z pętlą for:
Kod
Warning: Invalid argument supplied for foreach() in C:\WebServ\httpd\gra-obiektowo\classes\temp.class.php on line 40