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
$xml=("http://www.rssmix.com/u/8252161/rss.xml");
$files = glob('content/*.{json}', GLOB_BRACE);
$xmlDoc = new DOMDocument(); foreach($files as $file) {
$xmlDoc->load($xml); //do your work here
//get elements from "<channel>"
$channel=$xmlDoc->getElementsByTagName('channel')->item(0); $url = $file;
$channel_title = $channel->getElementsByTagName('title') $content = file_get_contents($url);
->item(0)->childNodes->item(0)->nodeValue; $json = json_decode($content, true);
$channel_link = $channel->getElementsByTagName('link') echo '<li class="rant-comment-row-widget" data-id="829770" data-type="rant" style="background-color:#243447;color:white;"><div class="rantlist-title-text" >';
->item(0)->childNodes->item(0)->nodeValue; echo $json{title};
$channel_desc = $channel->getElementsByTagName('description') echo " - ";
->item(0)->childNodes->item(0)->nodeValue; echo $json{author};
echo '</div> <';
//output elements from "<channel>" echo $json{type};
echo("<p><a href='" . $channel_link echo ' src="';
. "'>" . $channel_title . "</a>"); echo $json{src}; echo '" href="';
echo("<br>"); echo $json{href};
echo($channel_desc . "</p>"); echo '" width=100%>';
echo $json{body};
echo '</';
//get and output "<item>" elements echo $json{type};
$x=$xmlDoc->getElementsByTagName('item'); echo '>';
for ($i=0; $i<=2; $i++) { echo '</li>';
$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>