Hi, i need some help doing the following: I got a picturegallery, and those pictures are displayed by a script in thumbnail/fullsize. The images are stored in different folders. Now i want to add a description for some of theese pictures, which should be stored in a .txt (no database). The textfile is in the appropriate folder and looks like this: file011.jpg Description to file1 file02.jpg description file2 .... now i want to print the description linked to the picture by using $filename. could someone tell me how to do that please? thanks in advance
Out of interest, is there any reason you're against using a database for this? It'll be a lot more efficient (and also easier).
yes, the main reason is that i am new to this and have no time to setup a database right now / learning how to do it. i thought it could be just some lines of code for me to do the job since those textfiles dont have more than 30 lines right now.
By the time you work out bugs with duplicate filenames & whatnot, you'ld have used less time learning to do it with a database.
You will probably want a text file for each folder. You can use $var = file_get_contents('filename'); Code (markup): to put the contents of the file into the $var variable. You may have to explode the variable to create an array and then search for the file name in that array. It will be quite messy and will probably be easier to use a database.
The file() command loads a file into an array automatically (line by line). You can then while/for loop it, and print each file & description,. Jay