Re: Re: How to take output from an include, and embed it into a variable?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> $file = 'invoicetable_bottom.php';
> fopen("http://yoursite.com/folder/$file","r";);
>
> http://tr.php.net/function.fopen
>
> worth trying. Easier than output buffering

Easier in what sense? It would end up requiring more code than
output-buffering because you'd have to read from the file after
calling fopen(), check for end-of-file, etc., and it seems needlessly
inefficient because it:

- uses a function, fopen(), instead of a language construct, include()
- generates a superfluous HTTP request

I think it's also counter-intuitive. I ran across a similar technique
in some code I was reviewing and I had to really scratch my head and
wonder why the original author of the code did that, instead of just
getting at the file via the local file system.

Finally, it would require the OP to store an include()-ed file inside
of DocumentRoot -- which I personally prefer not to do when I can
avoid it (although that approach is debatable).

Ben

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux