Mam taki kod:
<?php
class szablon {
public $nazwa_gry;
public $nazwa;
public function ustaw_nazwe($nazwa) {
$this -> nazwa_gry = $nazwa;
return $this -> nazwa_gry;
}
}
$obiekt = new szablon;
echo 'Nazwa gry to' . $obiekt -> ustaw_nazwe
('Gra - wojownicy');
class naglowki {
public $ktory;
public $gdzie;
public $wynik;
public $page_content;
public function ustaw($ktory,$gdzie)
{
$this -> ktory = $ktory;
$this -> gdzie = $gdzie;
//echo $this -> wynik;
}
}
//$page_content = file_get_contents("pages/main.html");
$czesc = new naglowki;
$czesc -> ustaw("!!HEADER!!", 'design/header.html');
/*
$page_content = str_replace("GORA", file_get_contents("design/common_tags.html"),$page_content);
$page_content = str_replace("NAGLOWEK", file_get_contents("design/header.html"),$page_content);
$page_content = str_replace("LEWA", file_get_contents("design/left_column.html"),$page_content);
$page_content = str_replace("PRAWA", file_get_contents("design/right_column.html"),$page_content);
$page_content = str_replace("STOPKA", file_get_contents("design/footer.html"),$page_content);
$page_content = str_replace("DOL", $nazwa_gry,$page_content);
echo $page_content;
*/
?>
dostaje blad:
Cytat
Catchable fatal error: Object of class naglowki could not be converted to string in C:\xampplite\htdocs\gra\index.php on line 33
Probowalem na rozne sposoby, ale nie mam pojecia dlaczego taki blad