Hello,
I have not extensive experience with PHP beyond VERY basic stuff (using mostly mail, include files, etc) though I am now on hunt for an answer about a reading from flat file. Searched for long time but cannot find the answer.

I am designing a website that will have on each page a slider. There is several files, but each page will display the slides (div with some text) in different order. I was hoping to find a script that would do exactly that. Curently I made it work but it displays the divs in the same order and I can see now why. Is there a way to specify lines in the text file that I would then echo to the php file? Currently I have

<?php
$fp = fopen('flat.txt','r');
if (!$fp) {echo 'ERROR: Unable to open file.</table></body></html>'; exit;}
$loop = 0;
while (!feof($fp)) {
$loop++;
$line = fgets($fp, 1024); //use 2048 if very long lines
$field[$loop] = explode ('|', $line);
echo
$field[$loop][0];
$fp++;
}
fclose($fp);
?>

anybody knows how to read it where only specific lines (say 5,3,6) would be displayed?

    Not sure if this is what you're looking for, but you could read the file into an array via the [man]file/man function, then pick which line you want to read by accessing that element of the array (remembering that line #1 will be array index 0 (zero).

      what slide program are you using?

      are there no settings within the javascrpit to do what you want?

      Are you able to show us the whole page? there might be an easier way!!!

        Write a Reply...