Решил я опробовать Объектно ориентированное программирование, начитался умных книжек в итоге замучился с $this->
и т.д. и т.п. но вроде понял что требо
в итоге что мне пишет апача:
Fatal error: Call to a member function on a non-object in d:\\apache\\htdocs\\znak2\\index.php on line 134
Код скрипта:
include("template.php");
$a=new template();
$needed_templates="footer, header";
$a->printtemplate($needed_templates);//ругается на эту строчку
Код класса:
<?php
class template
{
var $tbl_database="znak";
var $tbl_template="template";
var $tbl_title="title";
function template()
{
unset ($cashedtemplates);
}
function cashetemplates($neededtemplates)
{
$this->query="select $this->tbl_template,$this->tbl_title from $this->tbl_database where ($this->tbl_title in(\'$neededtemplates\') ";
$this->result=mysql_query($this->query);
while($this->row=mysql_fetch_array($this->query))
{
$template_key=$this->tbl_title;
$cashedtemplate["$row[$template_key]"]=$row["$this->tbl_template"];
}
global $cashedtemplate;
}
function printtemplate($tempname)
{
print "blabla";
}
}
?>