Displaying vShare RSS Feeds on html pages
In this thread: posting.php?mode=reply&f=3&t=220 there's php code that will display the RSS Feeds from vShare sites into html format:
Code:
<table width=100%><tr><td width=100%>
<h2><a href=http://www.AltVenue.com>Currently on AltVenue.com</a></h2>
<dl>
<?php
$RSSFile = "http://www.altvenue.com/rss.php";
$insideitem = false;
$tag = "";
$title = "";
$description = "";
$link = "";
function startElement($parser, $name, $attrs) {
global $insideitem, $tag, $title, $description, $link;
if ($insideitem) {
$tag = $name;
} elseif ($name == "ITEM") {
$insideitem = true;
}
}
function endElement($parser, $name) {
global $insideitem, $tag, $title, $description, $link;
if ($name == "ITEM") {
printf("<dt>%s</dt>",
trim($link),htmlspecialchars(trim($title)));
//printf("<dd>%s</dd>",htmlspecialchars(trim($description)));
printf("<dd>%s</dd>",trim($description));
$title = "";
$description = "";
$link = "";
$insideitem = false;
}
}
function characterData($parser, $data) {
global $insideitem, $tag, $title, $description, $link;
if ($insideitem) {
switch ($tag) {
case "TITLE":
$title .= $data;
break;
case "DESCRIPTION":
$description .= $data;
break;
case "LINK":
$link .= $data;
break;
}
}
}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
$fp = fopen($RSSFile,"r")
or die("Error reading RSS data.");
while ($data = fread($fp, 4096))
xml_parse($xml_parser, $data, feof($fp))
or die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);
?>
</dl>
</td></tr></table>
I figured out that if I put the above PHP code into something like videos.php and then call it from an <iframe> on an html page, it works really, really nice, however, what I can't figure out is how to control the lay-out of what's being displayed. For instance, I only want to display the last 3 videos uploaded and also not have margins for the video descriptions and details indented quite as far as is being displayed.
I've searched the 'net for something along these lines and the only thing that comes close is http://www.rss2html.com which is free and customizable by using templates but it won't display the thumbs for the videos, it's mainly for regular news feeders and articles.
Anybody know of a script similar to the above that is more configurable in terms of layout?
To give you an idea, I'm trying to put "The last 3 videos uploaded to sca-video.com" on the left side of an SCA related web site (personal site) http://grynmoors.org/ but the display is all weird. The image and description/details is all indented too far to the right. If I can get it moved over to the left, it will fit in the 200px column I have set up for it.
Re: Displaying vShare RSS Feeds on html pages
i use xsitepro2 to create a full site with rss feeds
Re: Displaying vShare RSS Feeds on html pages
Thanks for the tip, I'll check it out
Right now I don't need to create an entire web page with the RSS for the site mentioned, just the one column.
There's also the rss2html (free) mentioned earlier which seems to do the same thing as this xsitepro2 ...just not as fancy as what you have, but it works...the rss2html is template driven and there are templates for it at feedforall.com, and I would use it except it doesn't display the video thumbs and I'm no PHP expert...but I guess I'll just have to keep working on this till I figure something out or someone else already knows.
Re: Displaying vShare RSS Feeds on html pages
Oh, hey, I'm on to something. I think it has to do with the <dd> and <dt> tags.
UPDATE:
Yep that was it, I had to get rid of all the dd, dt and dl tags then in videos.php I had to put everything a div box that was 180px wide.
The only thing I need to figure out now is how to get it to only display a certain number of items instead of all 20. If anybody can help me with that, I'd really appreciate it.
Re: Displaying vShare RSS Feeds on html pages
Oh now THIS is really slick and it's free
http://simplepie.org/