Re: include vs. fread

From: Date: Wed, 11 Oct 2000 14:35:33 +0000
Subject: Re: include vs. fread
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-19607@lists.php.net to get a copy of this message
Hi Geoffrey: > Is there a better way to include the contents of file for inclusion within > another file? For example, with templates is it better to create files that > are of the form: > > echo ".... a whole bunch of stuff here..."; > > and then call an include() within your script. > > Or, is it better to do an fread() to include the contents of the file? Depends what form the other file takes and how you want to code your program. In general, it's best use include() or require() in the primary file. This displays the second file's text inline into the browser. But, if you want the secondary file's contents to be placed into a variable which you can then manipulate inside your PHP code before passing it to the browser, then you should use fread(), fgets(), fgetcsv(), etc... --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y More than just answers. Solutions. (SM) http://www.analysisandsolutions.com/ 4015 7 Av #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

« previous php.general (#19607) next »