I am having difficulties with this coding in line 48 and 49. It tells me this error.
Warning: feof(): supplied argument is not a valid stream resource in /home/herbals/public_html/community/membersonly/template.php on line 48
Warning: fgets(): supplied argument is not a valid stream resource in /home/herbals/public_html/community/membersonly/template.php on line 49
I'm dumfounded. Here is the entire code.
<?php
/
class: template
purpose: template engine
/
class template extends membersonly{
/
function: define_file
purpose: defines template file
/
function define_file($file){
$this->template_file=$file;
$this->template_regioncount=-1;
}
/
function: add_region
purpose: adds template dynamic region
/
function add_region($region,$value){
$this->template_regioncount++;
$this->template_regions[$this->template_regioncount]=$region;
$this->template_regionvalues[$this->template_regioncount]=$value;
}
/
function: debug
purpose: set debugging to true
/
function debug(){
$this->template_debug="true";
}
/
function: make_template
purpose: make and display template
/
function make_template() {
$fp = @fopen($this->membersonly_path.$this->template_dir.$this->template_file,"r");
$regioncount=count($this->template_regions);
for ($i=0; $i<$regioncount; $i++){
if ($this->template_regions[$i]=="headers"){
$page=$this->template_regionvalues[$i];
}
}
$page.="<!--This community runs on Herbal Sacred Ground Web Hosting ".$this->membersonly_version."\nhttp://herbalsacredground.com-->\n";
while (!feof($fp)){
$line = fgets($fp);
$line = stripslashes($line);
$line = preg_replace("/href=\"..\//","href=\"".$this->membersonly_webpath,$line);
$line = preg_replace("/src=\"..\//","src=\"".$this->membersonly_webpath,$line);
for ($i=0; $i<$regioncount; $i++){
$line = preg_replace("/{".$this->template_regions[$i]."}/",$this->template_regionvalues[$i],$line);
}
$page.=$line;
}
$tempfile=$this->membersonly_path.$this->template_tempdir.rand(111111111,999999999).".php";
$temp = @fopen($tempfile,"w+");
fwrite($temp, $page);
fclose($temp);
include ($tempfile);
if ($this->template_debug=="false"){
unlink($tempfile);
}
}
}
?>
It's probably something stupid again...lol.
Blessings,
Herbal