Re: [PHP] include()ing into a variable

2004-10-14 Thread Curt Zirzow
* Thus wrote Mag: > Hi Curt, > Thanks for replying. > > > $obSaveFile = new SaveToFile(); > > $obSaveFile->open('/path/to/file.html'); > > ob_start(array(&$obSaveFile, 'save'), 1024); > > > > /* do your stuff here */ > > > > ob_end_flush(); > > $obSaveFile->close(); > > > Problem is, I have n

Re: [PHP] include()ing into a variable

2004-10-14 Thread Mag
Hi Curt, Thanks for replying. > class SaveToFile { > function open($file) { > //open file... > } > function write($buf) { > //write to file... > } > function close() { > //close file > } > } > $obSaveFile = new SaveToFile(); > $obSaveFile->open('/path/to/file.html'); > ob

Re: [PHP] include()ing into a variable

2004-10-14 Thread Gerard Samuel
Mag wrote: Hi, I have never done this before (but in my first test it seems to work), I am include()ing a file into a variable like this: $a=include("th-file.php"); Will this give me any extra problems later on? or is this resource intensive? I've seen other people do something similar to this, but

Re: [PHP] include()ing into a variable

2004-10-14 Thread Simas Toleikis
ApexEleven wrote: I believe that include() returns true|false, so $a would equal true if the file is included and false if it is not. If you use *return* on global scope in include file that value will be returned to $a. -- test.php -- $test = "Hello"; return $test; - $a = include "test.php";

Re: [PHP] include()ing into a variable

2004-10-14 Thread Curt Zirzow
* Thus wrote Mag: > Hi, > I have never done this before (but in my first test it > seems to work), I am include()ing a file into a > variable like this: > > $a=include("th-file.php"); > > Will this give me any extra problems later on? or is > this resource intensive? > > The reason I am doing th

RE: [PHP] include()ing into a variable

2004-10-14 Thread Jesse Castro
[snip] $a=include("th-file.php"); [/snip] Mag, I have never seen this approach before. This is the way I would do something like that. $file="./th-file.php"; if (!($fp = fopen($file,"r"))){ echo "Could not open ".$file; exit(); } $a = fread($fp, filesize($file)); fclose($fp);

Re: [PHP] include()ing into a variable

2004-10-14 Thread ApexEleven
I believe that include() returns true|false, so $a would equal true if the file is included and false if it is not. On Thu, 14 Oct 2004 10:35:15 -0700 (PDT), Mag <[EMAIL PROTECTED]> wrote: > Hi, > I have never done this before (but in my first test it > seems to work), I am include()ing a file in