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

From: Date: Wed, 23 Sep 2009 16:13:49 +0000
Subject: Re: Re: How to take output from an include, and embed it into a variable?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-298290@lists.php.net to get a copy of this message
> $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

« previous php.general (#298290) next »