1

Update index.php

This commit is contained in:
Evan Pratten 2017-09-12 19:57:55 -04:00 committed by GitHub
parent 0e929584e1
commit ff3581e9a4

View File

@ -97,45 +97,42 @@
<div class="rantlist-bg"> <div class="rantlist-bg">
<ul class="rantlist"> <ul class="rantlist">
<?php <a class="twitter-timeline"
href="https://twitter.com/TwitterDev"
data-height="auto"
data-chrome="nofooter"
data-link-color="#820bbb"
data-border-color="#a80000">
Tweets by @TwitterDev
</a>
<?php
$files = glob('content/*.{json}', GLOB_BRACE);
foreach($files as $file) {
//do your work here
$xml=("http://www.rssmix.com/u/8252161/rss.xml"); $url = $file;
$content = file_get_contents($url);
$xmlDoc = new DOMDocument(); $json = json_decode($content, true);
$xmlDoc->load($xml); echo '<li class="rant-comment-row-widget" data-id="829770" data-type="rant" style="background-color:#243447;color:white;"><div class="rantlist-title-text" >';
echo $json{title};
//get elements from "<channel>" echo " - ";
$channel=$xmlDoc->getElementsByTagName('channel')->item(0); echo $json{author};
$channel_title = $channel->getElementsByTagName('title') echo '</div> <';
->item(0)->childNodes->item(0)->nodeValue; echo $json{type};
$channel_link = $channel->getElementsByTagName('link') echo ' src="';
->item(0)->childNodes->item(0)->nodeValue; echo $json{src}; echo '" href="';
$channel_desc = $channel->getElementsByTagName('description') echo $json{href};
->item(0)->childNodes->item(0)->nodeValue; echo '" width=100%>';
echo $json{body};
//output elements from "<channel>" echo '</';
echo("<p><a href='" . $channel_link echo $json{type};
. "'>" . $channel_title . "</a>"); echo '>';
echo("<br>"); echo '</li>';
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> </div>