Forum Moderators: coopster

Message Too Old, No Replies

help with dynamic site

         

yuppster

5:07 pm on Jan 10, 2005 (gmt 0)

10+ Year Member



I'm really new to php and need some guidance. I'm making a site that is a list of links, and when clicked, they will load up a small description and a graphic into (a part) of the same page. Each link shows different stuff. I don't want to have to create a new page for every link. What would be the easiest way to do this? What would be the easiest way to store all the information (the descriptions, and images)? I've messed around a little with putting them all in an array.. I don't know if that's the right thing to do. I'm just trying to get on the right track. Sorry for the dumb question.
Thanks!

Salsa

5:28 pm on Jan 10, 2005 (gmt 0)

10+ Year Member



I think there's little question that the best solution for your application would be to store your data in a database--probably MySQL [dev.mysql.com]. That way you'd need just one page (script) to display the results for every link, and they could all be uniformly formatted.

I hope this helps.

yuppster

6:48 pm on Jan 10, 2005 (gmt 0)

10+ Year Member



Thanks for the response. Is there another way to do it that's more of an intermediate step in between making a bunch of pages and a mysql database? I don't have a massive amount of information, but enough that it would be annoying to make pages all the time. Any ideas?

timster

6:50 pm on Jan 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I agree that the easiest (in the long term) way to store the information would be a SQL database. But I don't think that's the best place to store the images.

I prefer to store the images in a directory and save their filenames in the SQL database. The database stays (much) smaller and the image files easier to check out and fiddle with.

Whether you keep the images in the database or in the file system, the images will probably be the trickiest part here. You might want to get the hang of SQL a little before you add handling images to the mix.

timster

6:52 pm on Jan 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



a bunch of pages and a mysql database

With the MySQL database, you won't need a bunch of pages. You should be able to add more entries without creating any new pages.

yuppster

6:56 pm on Jan 10, 2005 (gmt 0)

10+ Year Member



I was talking about a different way to store the data (descriptions and links to images) other than a database... like in an array or an external file somehow through php. I just don't think I'm technically up to messing with a database just yet. Thanks alot.

Salsa

9:03 pm on Jan 10, 2005 (gmt 0)

10+ Year Member



Gosh, this is a ...ster-ing thread.

Timster: I didn't mean to suggest storing the images themselves in the database, but only the paths to them, alt text, etc.

Yuppster: I suppose that if you feel more comfortable writing and reading files than you do working with a database, you could come up with a format for storing the data in a flat file. If you're not trying to store too much, the simplest thing might be to serialize() [us2.php.net] your array(s) and write those to a file.

I hope this helps.

kilonox

6:02 pm on Jan 11, 2005 (gmt 0)

10+ Year Member



I was talking about a different way to store the data (descriptions and links to images) other than a database... like in an array or an external file somehow through php. I just don't think I'm technically up to messing with a database just yet. Thanks alot

If it were me, trying to make do with some text files heres what I might do:

-i would store all the info that you say you would get when you clicked on a link, in a single textfile, with the file name being the link itself. You can get the list of them from directory reading functions, or alternately make a separate file with urls in it, one per line.
-the format of a single file of one url would be something like the image path on the first line, and the rest of the file being description text. If you wanted to you could keep the image filename the same as a url and load it up simply like that (i.e. www.foo.com.jpg)

hth-