tonysparks Posted March 26, 2007 Share Posted March 26, 2007 I'm designing a website that is update several times a week with a new gallery of images. Each set of images is stored in it's own directory with a page that generates a gallery and textually describes the images in the directory. I want to create a page that reads from a list of the image directories and dynamically generates a link to each gallerey, 10 to a page. something like this: directorylist.txt index.php reads directorylist.txt, places the first gallery listed at the top of the page, then 9 more links to the next 9 galleries. At the bottom of this page, links to the pages that contain galleries 11-20, 21-30, etc. I have already created functions that take the gallery ID and generate the links, I just can't seem to figure out how to read from the text file, then generate the links in my main pages Link to comment https://forums.phpfreaks.com/topic/44272-read-txt-file-and-pass-each-line-as-variable-in-a-function/ Share on other sites More sharing options...
AndyB Posted March 26, 2007 Share Posted March 26, 2007 <?php $lines = file("directorylist.txt"); // generates an array from the text file $size_of_list = count($lines); // number of entries ... more code ... ?> Does that help? Link to comment https://forums.phpfreaks.com/topic/44272-read-txt-file-and-pass-each-line-as-variable-in-a-function/#findComment-215056 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.