Advertisement
michaelyuen

Untitled

Sep 5th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. <?php
  2. if(!empty($rss_feed)) {
  3.     $i = 1;
  4.     foreach ($rss_feed->channel->item as $feed_item) {
  5.         if ($i < 9 ) {
  6. ?>
  7.         <a href="description.php?feed=<?php echo $i; ?>">
  8.         <div class="post-box">
  9.         <div class="rss-img"><?php echo "<img src='$feed_item->image'/>"; ?></div>
  10.         <br>
  11.         <div class="post-text"><a class="feed_title" href="technology-news-page.php" target="_blank"><?php echo $feed_item->title; ?></a></div>
  12.         <!--<div><?php /*?><?php echo implode(' ', array_slice(explode(' ', $feed_item->description), 0, 14)) . "..."; ?><?php */?></div>-->
  13.         </div>
  14.         </a>
  15. <?php  
  16.         $i++;
  17.         }
  18.     }
  19. }
  20. ?>
  21.  
  22. technology-news-page.php
  23.  
  24. if (isset($_GET['feed'])) {
  25.     $feed = $_GET['feed'];
  26.     $rss_feed = simplexml_load_file("http://feeds2.feedburner.com/Propakistani");
  27.     if (isset($rss_feed->channel->item[$feed])) {
  28.         $feed_item = $rss_feed->channel->item[$feed];
  29.         echo $feed_item->title;
  30.     } else {
  31.         echo 'Feed is not available or has been removed';
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement