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,43 +97,40 @@
<div class="rantlist-bg"> <div class="rantlist-bg">
<ul class="rantlist"> <ul class="rantlist">
<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 <?php
$files = glob('content/*.{json}', GLOB_BRACE);
$xml=("http://www.rssmix.com/u/8252161/rss.xml"); foreach($files as $file) {
//do your work here
$xmlDoc = new DOMDocument();
$xmlDoc->load($xml);
//get elements from "<channel>"
$channel=$xmlDoc->getElementsByTagName('channel')->item(0);
$channel_title = $channel->getElementsByTagName('title')
->item(0)->childNodes->item(0)->nodeValue;
$channel_link = $channel->getElementsByTagName('link')
->item(0)->childNodes->item(0)->nodeValue;
$channel_desc = $channel->getElementsByTagName('description')
->item(0)->childNodes->item(0)->nodeValue;
//output elements from "<channel>"
echo("<p><a href='" . $channel_link
. "'>" . $channel_title . "</a>");
echo("<br>");
echo($channel_desc . "</p>");
//get and output "<item>" elements $url = $file;
$x=$xmlDoc->getElementsByTagName('item'); $content = file_get_contents($url);
for ($i=0; $i<=2; $i++) { $json = json_decode($content, true);
$item_title=$x->item($i)->getElementsByTagName('title') 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};
$item_link=$x->item($i)->getElementsByTagName('link') echo " - ";
->item(0)->childNodes->item(0)->nodeValue; echo $json{author};
$item_desc=$x->item($i)->getElementsByTagName('description') echo '</div> <';
->item(0)->childNodes->item(0)->nodeValue; echo $json{type};
echo ("<p><a href='" . $item_link echo ' src="';
. "'>" . $item_title . "</a>"); echo $json{src}; echo '" href="';
echo ("<br>"); echo $json{href};
echo ($item_desc . "</p>"); echo '" width=100%>';
echo $json{body};
echo '</';
echo $json{type};
echo '>';
echo '</li>';
} }
?> ?>