[PHP] include()ing into a variable

2004-10-14 Thread 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 this is because I want to put whole pages

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 into a

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); See

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 this is

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 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 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');

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 not really learnt classes

[PHP] include-ing results in variable?

2001-10-27 Thread Nathaniel Merriam
This is what I'm trying to do, and I think I'm just missing some logic in how to think like PHP. I have a global included file (global.inc) where I set up variables, open the database, etc, and I include it in the header of every HTML file on the site. One thing I would like to set as a