Trying to Embed a Datafeed

They have: 6 posts

Joined: Jun 2007

Hi, everyone. I'm the ultimate newbie, webmastering my new site by myself without prior knowledge.

Today I need to learn how to embed a datafeed. It's an xml file. It's a feed from another site with product information. How do I get the feed onto my site? I'm a complete newbie-tech terms will fly right over my head.

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

If you're just looking for something to do the job a quick search on hotscripts.com found this: RSS Media Grabber or RSS data boxes.

As long as you have Linux hosting with PHP (although it should work on Windows hosting with PHP too Smiling ) you should be able to use these scripts to show feeds. Am assuming this is an RSS file you're trying to show?

*** EDIT ***
Here's another one (looks simple and promising): rss2html.

If you get any problems installing and configuring those scripts (or end up making one yourself) don't hesitate to come and ask questions here. Smiling

a Padded Cell our articles site!

They have: 6 posts

Joined: Jun 2007

Thank you very much. If I may ask, would you happen to know of any resources for csv files? I Googled all day yesterday and the most I got was that it had to be transferred to a database of some kind. I've downloaded the file and everything, but now there's a blank box where the feed is supposed to be. I just poked around, looking for code to put it up, but apparently there's more to it than that.

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Whitestone wrote: Thank you very much. If I may ask, would you happen to know of any resources for csv files?

I did have a look, but couldn't find anything. CSV files are so easy to parse people probably think it's not worth publishing a script for. Smiling

This could be a good learning exercise, if you're willing... Smiling

Whitestone wrote: the most I got was that it had to be transferred to a database of some kind

Wouldn't even need to do that. Think about it, all you need to do is loop through every character in the file, when you get to a comma just print a [incode][/incode] or [incode][/incode] (depending on whether you're using tables or not). If you are using tables you'll also need to print a [incode][/incode] every time you encounter a carriage return in the csv file. Smiling

*** EDIT ***
By the way, where is this csv feed coming from? It's unusual that this sort of thing isn't done using RSS, also I thought you said it was an XML file? Just might be able to help better if we know a bit more of the story. Smiling

a Padded Cell our articles site!

They have: 6 posts

Joined: Jun 2007

Yes, I'm definitely willing to learn. So what is parsing?

Looping. I'm not familiar with that term.

The original is a csv file, which I used to convert it to xml. I don't know what that means, only that I read someowhere that I had to do that. So, I found a converter and used it-if I did it right. (I saved the original file in any case, so I still have the csv, and a hopefully correct xml. THen somewhere along the line I get the impresion RSS is supposed to enter the picture somewhere, but I don't knw what any of that means, only that that is supposed to be the case and that CSV is going to require legacy support (I do know what that means) and that it is hard on the system. So that's where I left off yesterday. I think the ultimate goal is to get it into an RSS feed. But why, how, and what are the missing factors yet. In other words, I'm missing act two of a three-act screenplay.! Smiling

I downloaded the rss2html yesterday, extracted it...and now I have to figure out what to do with it to install it, and where to install it.

With linux, of course, all that isn't automatic like it is with windows. With windows, you click an icon and the job is done. Linux makes you get into the nitty gritty. What have I gotten myself into! Laughing out loud

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Whitestone wrote: So what is parsing?

Simply put, it's a program munching through some data. Usually it breaks the data down into chunks that some operation can be performed upon. Your script needs to parse a csv file, breaking it down into chunks according to where the commas are. Smiling

Whitestone wrote: Looping. I'm not familiar with that term.

It's doing the same thing, over and over again. Like splitting up a csv file into chunks according to where the commas are. Then looping through each chunk, printing it out with [incode][/incode] around it. This is simplified, but should let you get the gist.

Whitestone wrote: The original is a csv file, which I used to convert it to xml. I don't know what that means, only that I read someowhere that I had to do that. So, I found a converter and used it-if I did it right. (I saved the original file in any case, so I still have the csv, and a hopefully correct xml. THen somewhere along the line I get the impresion RSS is supposed to enter the picture somewhere, but I don't knw what any of that means, only that that is supposed to be the case and that CSV is going to require legacy support (I do know what that means) and that it is hard on the system. So that's where I left off yesterday. I think the ultimate goal is to get it into an RSS feed. But why, how, and what are the missing factors yet. In other words, I'm missing act two of a three-act screenplay.!

Whoah there Skippy! You might as well drop all these thoughts, this is a very long and over-complicated way of solving your problem. How about having a system that works like this:

  1. Upload products csv file to your server, call it: [incode]products.csv[/incode]
  2. You point your browser to a special page on your domain, which parses the csv: converting it into an html file. Call the output file: [incode]products.html[/incode]
  3. The main page uses the php [incode]include[/incode] statement, to pull the contents of [incode]products.html[/incode]

It's rather hacky, but should work. Your server would be somewhat vulnerable if you left the conversion script on it, you could just upload it every time you need to convert the CSV file to html.

How does that sound? Or have you found another solution? Smiling

a Padded Cell our articles site!

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Sorry for double-posting but I just saw this:

Whitestone wrote: With linux, of course, all that isn't automatic like it is with windows. With windows, you click an icon and the job is done. Linux makes you get into the nitty gritty. What have I gotten myself into!

Just try doing this on Windows, I guarantee it isn't as easy as you might think it is. Smiling

Saying that, there are a couple of utilities which might convert the csv to html for you (on both Windows and Linux). I just converted csv to html using OpenOffice and KOffice (KOffice did a slightly better job).

So if you want to use eazy tools, go ahead. Problem is--under both Windows and Linux--these tools write dirty code and you don't get to learn anything! By the time you've cleaned up the bad results from these programs 10 times you might as well have learned some rudimentary PHP programming. Smiling

a Padded Cell our articles site!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.