|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Where to put RSS XML Code on Website
I have my ownwebsite, and would like to fill some contents onto the website using RSS feeds from other websites. I know you need to use a RSS feed reader, but where do you put the XML codes? I tried to cut and paste the XML codes onto my webpage, it did not work. If that has to be on the webserver, what extension should I use? Newsgater says use the following to display, http://www.newsgator.com/ngs/subscr...px?url=feed_URL, it would then display Newsgator user login, how do I bypass that, so the readers who goto my webpage would just be able to read the news or the content?
Vivien Last edited by noixglacee : July 15th, 2006 at 01:35 PM. |
|
#2
|
||||
|
||||
|
try somthing like www.rss2html.com
__________________
|
|
#3
|
||||
|
||||
|
Here's a bit of code that will display the rss feed on a php page. (I got it originally from a member at dp). Just put the url of the actual feed into the script where it says FULL URL HERE
Code:
<?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><a href='%s'>%s</a></dt>",
trim($link),htmlspecialchars(trim($title)));
printf("<dt>%s</dt><br>",htmlspecialchars(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 "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("FULL URL HERE","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);
?>
__________________
Web CEO: Ranking Reports, Keyword Research, Link Analysis |
|
#4
|
|||
|
|||
|
.net C# version available upon request
the only thing not to do is use one of the javascript solutions. Make sure the RSS is rendered as HTML on the page. |
|
#5
|
|||
|
|||
|
Thank you
Thanks for the codes, the php file displays as a separate webpage. How do you have the displays directly on intended webpage?
|
|
#6
|
|||
|
|||
|
i still don't know how to create RSS feed for your site, is there a free software or online service i can use to generate rss for my webpage?
|
|
#7
|
||||
|
||||
|
Quote:
Quote:
If that doesn't help, maybe be more specific on exactly what you're trying to do (db type, server, scripting language) Last edited by FogHorn : August 28th, 2006 at 03:42 PM. |
![]() |
| Viewing: SEO Chat Forums > Search Engine Strategies > Blogs, Tagging, RSS Feeds > Where to put RSS XML Code on Website |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|