include part of a text file

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
hello all.

I have a text document that stores text for use in a flash movie. I'm
also using PHP to displace the same text on another page. However the
text document includes 2 tags for use by the flash movie... title= and
&content=  ... see text file at end of post ....

when i use the php command <?php include ("info.txt"); ?> it also
displays those tags. Is there any way to use php to just display what
apprars after the &content= in my text file.

I can't remove the tag begause it is required for the flash file
elsewhere on the site.

title=CDN HOME &content=The COMPUTER DONATION NETWORK is a resource of
new, used and refurbished computer equipment, software, networking gear
and lab furnishings for "

grassy ass,
(Thank You)

Re: include part of a text file

Assuming "&content=" isnt anywhere else in the txt file, you could use
PHPs explode function like so...

$textfile= "/usr/local/something.txt";
$handle = fopen($textfile, "r");
$contents = fread($handle, filesize($textfile));

$content = explode("&content=", $contents);

fopen function..

fread function...

explode function...


Re: include part of a text file wrote:
Quoted text here. Click to load it

There's no need to use include() for anything other than PHP files.  If
you just want to output the contents of the file, use readfile()

Quoted text here. Click to load it


list(, $content) = explode('&content=', file_get_contents('info.txt'));

echo $content;  


Re: include part of a text file

Thank you so much. This worked like a charm

Site Timeline