Forum Moderators: coopster

Message Too Old, No Replies

conditional read from text file

         

kumarsena

6:42 pm on Jan 23, 2004 (gmt 0)

10+ Year Member



well sort of i think,

i need to read from a text file that contains a receipe. frst line is name of dish, second line is name of contributor if receipe. the rest is the content of receipe.

i can retrieve the title and name using file() but how do i get the rest of the content? i mean with file(), they are all in array, but i need to joisn them. but is htere anotehr way of ahieveing this..?

kumarsena

6:45 pm on Jan 23, 2004 (gmt 0)

10+ Year Member



his is what i have at the moment

<?php

$receipe= $_GET['receipe'];
$receipe_file = "receipes/$receipe";

$content_array = file($receipe_file);

echo "<font class=\"subtitle2\">$content_array[0]</font><br />";
echo "<font class=\"subtitle\">$content_array[1]</font><br />";

//$fh = fopen($receipe_file, 'r');


//$size = filesize($receipe_file);
//echo $size;
//$content = fread($fh, $size);

//fclose($fh);

//echo $content;

?>

bcolflesh

6:46 pm on Jan 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is a good article here:

devarticles.com/c/a/PHP/Working-With-Text-Files-in-PHP/