1

Update index.php

This commit is contained in:
Evan Pratten 2017-09-12 19:54:05 -04:00 committed by GitHub
parent 69e8b7edf5
commit 0e929584e1

View File

@ -97,29 +97,46 @@
<div class="rantlist-bg"> <div class="rantlist-bg">
<ul class="rantlist"> <ul class="rantlist">
<script> <?php
function showRSS(str) {
if (str.length==0) {
document.getElementById("rssOutput").innerHTML="http://www.rssmix.com/u/8252161/rss.xml"; $xml=("http://www.rssmix.com/u/8252161/rss.xml");
return;
} $xmlDoc = new DOMDocument();
if (window.XMLHttpRequest) { $xmlDoc->load($xml);
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest(); //get elements from "<channel>"
} else { // code for IE6, IE5 $channel=$xmlDoc->getElementsByTagName('channel')->item(0);
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); $channel_title = $channel->getElementsByTagName('title')
} ->item(0)->childNodes->item(0)->nodeValue;
xmlhttp.onreadystatechange=function() { $channel_link = $channel->getElementsByTagName('link')
if (this.readyState==4 && this.status==200) { ->item(0)->childNodes->item(0)->nodeValue;
document.getElementById("rssOutput").innerHTML=this.responseText; $channel_desc = $channel->getElementsByTagName('description')
} ->item(0)->childNodes->item(0)->nodeValue;
}
xmlhttp.open("GET","getrss.php?q="+str,true); //output elements from "<channel>"
xmlhttp.send(); echo("<p><a href='" . $channel_link
} . "'>" . $channel_title . "</a>");
</script> echo("<br>");
echo($channel_desc . "</p>");
//get and output "<item>" elements
$x=$xmlDoc->getElementsByTagName('item');
for ($i=0; $i<=2; $i++) {
$item_title=$x->item($i)->getElementsByTagName('title')
->item(0)->childNodes->item(0)->nodeValue;
$item_link=$x->item($i)->getElementsByTagName('link')
->item(0)->childNodes->item(0)->nodeValue;
$item_desc=$x->item($i)->getElementsByTagName('description')
->item(0)->childNodes->item(0)->nodeValue;
echo ("<p><a href='" . $item_link
. "'>" . $item_title . "</a>");
echo ("<br>");
echo ($item_desc . "</p>");
}
?>
<div id="rssOutput">RSS-feed will be listed here...</div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>