Click to See Complete Forum and Search --> : Using Comma-delimited text files in page


wtiger2
04-10-2006, 09:10 PM
I have a little bit different challenge to solve. :)

I have a customer who is a car dealer. He has a database that can only export data to comma-delimited text files. He wants to minimise data-entry repetition by using the data from those files to populate web pages with this data about the cars he has for sale. Max is about 30 vehicles, so a database on the server side is not practical for this.

Each car can be a seperate file (by Stock #), or I can have him export the ENTIRE list of cars to one text file. 3 photos will accompany each vehicle. He wishes to do the updates to the website himself, which is reasonable, but he is NOT tech savvy, so I have to automate this as much as possible.

Each vehicle would have it's own page on the site, and a list of all vehicles on the main page to link to each vehicle page...

I'm a bit rusty on this kind of thing, so I was hoping for some suggestions on how to approach this :)

Thanks in advance...
Fred

hyperlisk
04-10-2006, 09:16 PM
You could create one page, and pass in values through the URL. ie

cars.html?carID=1&img1=images/image1.jpg&img2=images/image2.jpg&img3=images/image3.jpg

Then just get the variables out of the URL and place the proper contents in a DIV or any other element.

A1ien51
04-10-2006, 09:18 PM
Look into Ajax XMLHttpRequest Object with an text file.

You can use the responseText and do a split(",") to get the data in an array and handle it that way.

Eric

phpnovice
04-10-2006, 10:33 PM
The only consideration will be if this comma-delimited data also contains commas within quoted text. If so, it would be better to use PHP on the server-side to parse the data (because PHP understands the CSV format) and hand it off to JavaScript pre-parsed. Of course, to use the XMLHttpRequest object, you're going to need some server-side document anyway.