ComicWisdom Posted September 25, 2006 Posted September 25, 2006 I'm not a PHP programmer, but I'm learning. Is it possible to extract the default text from a text file instead of needing to go into the PHP file every time I want to change it. For example can I do something like this. MAIN_TXT = "/mytextfile.txt" If it is, could someone give he the correct syntax, please. Thank you. I suppose I would need to add a line in the PHP program like: includes (/mytextfile) and define it in the filenames.php???? Just between us, remember there are only 10 kinds of people in the world; those who understand binary and those who don't!! Remember, learning is a "do-it-yourself" experience; although, not necessarily a "do-it-BY-yourself" experience. The quickest way to learn is to forget to BACKUP!
dave111 Posted September 25, 2006 Posted September 25, 2006 Do something like this: $handle = fopen("/FULL/PATH/TO/YOUR/FILE/mytextfile.txt", "rb"); $contents = ''; while (!feof($handle)) { $contents .= fread($handle, 8192); } fclose($handle); DEFINE('MAIN_TEXT',$contents); Obviously replace the /FULL/PATH/TO/YOUR/FILE/ with the full path to your file :)
ComicWisdom Posted September 25, 2006 Author Posted September 25, 2006 Thank you Just between us, remember there are only 10 kinds of people in the world; those who understand binary and those who don't!! Remember, learning is a "do-it-yourself" experience; although, not necessarily a "do-it-BY-yourself" experience. The quickest way to learn is to forget to BACKUP!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.