Newbie - Need help with class files

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jcrunch
Forum Newbie
Posts: 1
Joined: Tue Feb 08, 2005 4:01 pm

Newbie - Need help with class files

Post by jcrunch »

I am a rank amateur at PHP, so please don't slam me here, but:

I found a pair of PHP class files on phpclasses.org that seem to purport to do what I want. they are found at:

http://www.phpclasses.org/browse/package/2054.html

What I want is a site search for my already completed photo website, to find photos by keyword. I have a flat text file of all the thumbnail photo URLs and descriptions, and am wondering if and how these classes can be used to parse the text file to show thumbnails where the search term(s) match the description (and/or the file name, although almost all are named by date and time).

I tried to create a search webpage using the code included in the classes' documentation, but was unsuccessful. I'm missing something, but I have no idea what. Every query returns nothing but open and close html and body tags.

If I need to turn my flat text file into an mysql db or dbs, I'll do that, but that's another area of non-expertise for me.

Thanks for any help anyone can give me. I'll post whatever code I've kludged together that you may need to figure this out.
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

i would recomend storing the info in a database.

for something basic like this, its not that hard.
once thats done, it will be a peice of cake to search them.

this should help you.
http://sqlcourse.com/


but if you want to make it work with your current flat file db, ill assume you keep each record on its own line

all you would really do is look at each line 1 at a time, use something like strpos() to search for the string your looking for. if so, add that line to your list/array of matches.

then, display your matches.
Post Reply