Forum Moderators: open
If this post is in the wrong catagory I apologize but since it touches base on HTML, JavaScript, and RSS I was not sure where it fit.
<Sorry, no personal URLs.
See Terms of Service [webmasterworld.com]>
[edited by: tedster at 5:17 pm (utc) on Mar. 24, 2005]
For example, you create a copy of your current .htm page, save it as a .php or .asp file, then insert one of the two dufferent RSS reading scripts i've included on the end of this.
Then install your URL rewrite and make a rule that rewrites all .php / .asp file extensions back to .htm. You then get dynamic functionality with the legacy .htm name convention.
PS. Stay away from Javascript. I have seen Google make a little more effort than usual in delving into my javascript but it generally makes a mess of it.
PHP Rss reader:
<?php
//begin blog reader
function parse_rss($f) {
$xmlfile = fopen($f, 'r');
if (!$xmlfile) die('cannot open the xml file');
$readfile = fread($xmlfile ,40000);
$parsefile = eregi("<item>(.*)</item>", $readfile ,$arrayreg);
$filechunks = explode("<item>", $arrayreg[0]);
$count = count($filechunks);
echo '<font face=verdana><ul>';
for($i=1 ; $i<=$count-1 ;$i++) {
ereg("<title>(.*)</title>",$filechunks[$i], $title);
ereg("<link>(.*)</link>",$filechunks[$i], $links);
ereg("<description>(.*)</description>",$filechunks[$i], $description);
echo str_replace('hxaxh','a',"<li><font style='font-size: 12px;'><hxaxh target=_blank href ='$links[1]'\>".utf8_decode($title[1])."</hxaxh></font>");
echo "<br><font color=gray style='font-size: 10px;'>".utf8_decode($description[1])."</font></li>";
}
}
?>
<html>
<body>
'DISPLAYS FEED
<?php
$xmlfeed = 'http://rssfeedexample.com/rssfeed.asp';
parse_rss($xmlfeed);
?>
</body>
</html>
ASP Rss Reader:
<html>
<body>
<%
set xmlDoc = createObject("Msxml.DOMDocument")
xmlDoc.async = false
xmlDoc.setProperty "ServerHTTPRequest", true
xmlDoc.load("http://www.rssfeedexample.com/rssfeed.asp")
If (xmlDoc.parseError.errorCode <> 0) then
Response.Write "XML error: "& xmlDoc.parseError.reason
Else
set channelNodes = xmlDoc.selectNodes("//channel/*")
for each entry in channelNodes
if entry.tagName = "title"then
strChannelTitle = entry.text
elseif entry.tagName = "description"then
strChannelDescription = entry.text
elseif entry.tagName = "link"then
strChannelLink = entry.text
end if
next
set itemNodes = xmlDoc.selectNodes("//item/*")
For each item in itemNodes
if item.tagName = "title"then
strItemTitle = strItemTitle & item.text & "#%#"
elseif item.tagName = "link"then
strItemLink = strItemLink & item.text & "#%#"
elseif item.tagName = "description"then
strItemDescription = strItemDescription & item.text & "#%#"
elseif item.tagName = "pubDate"then
strItemPubDate = strItemPubDate & item.text & "#%#"
end if
next
arrItemTitle = split(strItemTitle,"#%#")
arrItemLink = split(strItemLink,"#%#")
arrItemDescription = split(strItemDescription,"#%#")
arrItemPubDate = split(strItemPubDate, "#%#")
response.write "<ul>"
for a = 0 to UBound(arrItemTitle) - 1
response.write "<li>"
response.write "<a target='_blank' href='"& arrItemLink(a) & "'>"& arrItemTitle(a) & "</a>"
if strItemDescription <> ""then
response.write "<br />"& arrItemDescription(a)
end if
if strItemPubDate <> ""then
response.write "<br />"& arrItemPubDate(a)
end if
response.write "</li>"
next
response.write "</ul>"
set channelNodes = nothing
set itemNodes = nothing
End If
%>
</body>
</html>