home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

php coding assistance with templete.php

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2614
Discussions: 200,996, Posts: 2,379,951, Members: 246,364
Old December 23rd, 2005, 02:29 PM   Digg it!   #1 (permalink)
Junior Member
 
Join Date: Dec 2005
Posts: 3
php coding assistance with templete.php

I get 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



Here is my 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);
}
}

}
?>
herbal_lavender is offline   Reply With Quote
Old December 28th, 2005, 11:13 AM     #2 (permalink)
Senior Member
 
bwcc's Avatar
 
Join Date: Nov 2001
Location: Central KS
Posts: 840
Best guess from looking at the function is that $fp is returning as false, due to the inability to find / open the file specified.
__________________
Im against picketing, but I dont know how to show it.
bwcc is offline   Reply With Quote
Old December 29th, 2005, 09:35 AM     #3 (permalink)
Junior Member
 
Join Date: Dec 2005
Posts: 3
Thanks.
herbal_lavender is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
mySQL coding assistance herbal_lavender Webmastering and Programming 2 December 28th, 2005 11:41 AM
php help Andybebad Webmastering and Programming 2 March 3rd, 2005 11:28 PM
PHP / MySQL coding help VillageIdiot906 Webmastering and Programming 3 February 22nd, 2005 11:54 PM
index.php?mode=something.php RyanD Webmastering and Programming 16 October 20th, 2004 11:20 PM
Need php help iNeb Webmastering and Programming 9 April 11th, 2003 12:38 AM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (3092)
Charges against non-tippers dropped.. (22)
Foxconn Blackops x48 MoBo (5)
Health Care Rationing (16)
Nvidia GTX 260 problem (14)
Delete an OS (17)
Laptop with wireless problem. (13)
Wireless Televisions. (12)
windows vista security holes (19)
CPU fan stops spinning randomly (11)
Regular Build (11)
Point and Shoot Camera Suggestions. (9)
[F@H SPAM 11/16/09] ! 1/2 months to.. (41)
windows 7 problem (7)
Recent Discussions
add ram to existing (3)
Need help getting speakers to work (2)
Nvidia GTX 260 problem (14)
Laptop with wireless problem. (13)
Point and Shoot Camera Suggestions. (9)
Is the PSU I received dead? (16)
FreeAgent drive software not x64 comp.. (1)
Intel 5100 AGN issues fixed yet? (28)
Foxconn Blackops x48 MoBo (5)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (41)
Print spooler problem (17)
Q9650 vs. Q9550 (2)
Desktop Calendar Application (2)
Looking for new motherboard (1)
soundmon.exe (8)
Jedi Academy Problem (3)
Can a page file be "too big".. (1)
Size after cutting 700Mb file is 2.5 .. (0)
Delete an OS (17)
windows vista security holes (19)
updating BIOS via winflash, claims fi.. (1)
New Server Configuration Suggestions (0)
cheap gaming laptop? (12)
Unallocated Space (2)
help me pls laptop just stopped worki.. (1)


All times are GMT -4. The time now is 12:05 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28