I have a website I'm building in Flash that shows differnent images, like a slideshow. Each image is accompanied by a paragraph of text. I would like all the paragraphs to be contained in a single text file. How do I address part of a text file in PHP? I know I could have a separate text file for each paragraph - but I really want them all in one. Also, I'm not ready to get into MYSQL or anything like that. I'm still trying to get my head around PHP. Right now I use a simple PHP file like this:
<?php
$Submit = $_POST["Submit"];
$bookTitle = $_POST["bookTitle"];
$Author = $_POST["author"];
$Publisher = $_POST["publisher"];
$Link = $_POST["link"];
$NumLow = $_REQUEST["NumLow"];
$NumHigh = $_REQUEST["NumHigh"];
$filename = "books.txt";
$Comments = stripslashes($Comments);
if ($Submit == "Yes") {
$fp = fopen( $filename,"r");
$OldData = fread($fp, 80000);
fclose( $fp );
$Input = "<font color=\"#990000\">$bookTitle</font><font face=\"FFF Corporate\"><br>by $Author<br><font color=\"#999999\">$Publisher<br></font></font><font color=\"#FF0000\">----------------------------<br></font>.:::.";
$New = "$Input$OldData";
$fp = fopen( $filename,"w");
if(!$fp) die("&comp=cannot write $filename ......&");
fwrite($fp, $New, 800000);
fclose( $fp );
}
$fp = fopen( $filename,"r");
$Data = fread($fp, 800000);
fclose( $fp );
$DataArray = split (".:::.", $Data);
$NumEntries = count($DataArray) - 1;
print "&TotalEntries=$NumEntries&NumLow=$NumLow&NumHigh=$NumHigh&comp=";
for ($n = $NumLow; $n < $NumHigh; $n++) {
print $DataArray[$n];
if (!$DataArray[$n]) {
Print "<br><br><b>No More entries</b>";
exit;
}
}
?>