⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rss2html-pro-examples.txt

📁 for news RSS to HTML as ASP
💻 TXT
字号:
Example:     1 - Is the XML tag empty?Level:       SimpleDescription: This example template uses a very simple table to display a             feed.  The PHP code is used to check if ~~~ItemLink~~~ is             blank.  If it is blank only the title is display.  If it is             not blank, the title is made into a link.<<<<<<<<<<<<<<<<<<<<<<<<<<< START OF FILE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><html>  <head>    <meta http-equiv="content-type" content="text/html;charset=utf-8">    <title>~~~FeedTitle~~~</title>  </head>  <body>    <h1>~~~FeedTitle~~~</h1>    <p>~~~FeedDescription~~~</p>    <hr>    <table width="100%">      ~~~BeginItemsRecord~~~      <tr><td>~~~ItemPubShortDate~~~ ~~~ItemPubShortTime~~~</td></tr>      <tr><td><?php// Is the Item Link blank?if ("~~~ItemLink~~~" != "") {  // No it was not blank  echo "<a href=\"~~~ItemLink~~~\">~~~ItemTitle~~~</a>";} else {  // Yes it was blank  echo "~~~ItemTitle~~~";}?>      </td></tr>      <tr><td>~~~ItemDescription~~~</td></tr>      <tr><td><hr></td></tr>      ~~~EndItemsRecord~~~    </table>  </body></html><<<<<<<<<<<<<<<<<<<<<<<<<<<< END OF FILE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Example:     2 - How old is this item?Level:       MediumDescription: This example template uses a very simple table to display a             feed.  The PHP code will only display item that between 24	     and 72 hours old.<<<<<<<<<<<<<<<<<<<<<<<<<<< START OF FILE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><html>  <head>    <meta http-equiv="content-type" content="text/html;charset=utf-8">    <title>~~~FeedTitle~~~</title>  </head>  <body>    <h1>~~~FeedTitle~~~</h1>    <p>~~~FeedDescription~~~</p>    <hr>    <table width="100%">      ~~~BeginItemsRecord~~~<?php$okayToDisplay = 0;// Only find the time/date of an item if there was a PubDateif ("~~~ItemPubDate~~~" != "" ){  $pubDateTime = strtotime("~~~ItemPubDate~~~");  $now = time();  if ((24*60*60 <= ($now - $pubDateTime)) && (($now - $pubDateTime) <= 72*60*60)) {    $okayToDisplay = 1;  }}if ($okayToDisplay == 1) {  echo "<tr><td>~~~ItemPubShortDate~~~ ~~~ItemPubShortTime~~~</td></tr>";  echo "<tr><td>~~~ItemTitle~~~</td></tr>";  echo "<tr><td>~~~ItemDescription~~~</td></tr>";  echo "<tr><td><hr></td></tr>";}?>      ~~~EndItemsRecord~~~    </table>  </body></html><<<<<<<<<<<<<<<<<<<<<<<<<<<< END OF FILE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Example:     3 - Does the title or description contain this word?Level:       MediumDescription: This example template uses a very simple table to display a             feed.  The PHP code will look for certian words in the title	     or description of the items, and only those that have it.	     NOTE: stristr() is use to prevent problems with captial letters<<<<<<<<<<<<<<<<<<<<<<<<<<< START OF FILE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><html>  <head>    <meta http-equiv="content-type" content="text/html;charset=utf-8">    <title>~~~FeedTitle~~~</title>  </head>  <body>    <h1>~~~FeedTitle~~~</h1>    <p>~~~FeedDescription~~~</p>    <hr>    <table width="100%">      ~~~BeginItemsRecord~~~<?php$okayToDisplay = 0;// Look for the words "puppy" or "puppies"if ((stristr("~~~ItemTitle~~~", "puppy") !== FALSE) ||     (stristr("~~~ItemDescription~~~", "puppy") !== FALSE) ||    (stristr("~~~ItemTitle~~~", "puppies") !== FALSE) ||     (stristr("~~~ItemDescription~~~", "puppies") !== FALSE)) {  $okayToDisplay = 1;}if ($okayToDisplay == 1) {?>      <tr><td>~~~ItemPubShortDate~~~ ~~~ItemPubShortTime~~~</td></tr>      <tr><td>~~~ItemTitle~~~</td></tr>      <tr><td>~~~ItemDescription~~~</td></tr>      <tr><td><hr></td></tr><?php}?>      ~~~EndItemsRecord~~~    </table>  </body></html><<<<<<<<<<<<<<<<<<<<<<<<<<<< END OF FILE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Example:     4 - Get the image embedded in the descriptionLevel:       AdvancedDescription: This example template uses a very simple table to display an 	     items image embedded in the description.  The PHP code will extract	     the image, if any and display it in a seperate column and	     remove it from the description.<<<<<<<<<<<<<<<<<<<<<<<<<<< START OF FILE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><html>  <head>    <meta http-equiv="content-type" content="text/html;charset=utf-8">    <title>~~~FeedTitle~~~</title>  </head>  <body>    <h1>~~~FeedTitle~~~</h1>    <p>~~~FeedDescription~~~</p>    <hr>    <table width="100%">      ~~~BeginItemsRecord~~~<?php// Set initial values for our variables$theImage = "&nbsp;"; // To ensure proper display with borders$newDescription = "~~~ItemDescription~~~";$match = Array();// Use regular expressions to find <img ... >if (preg_match("/<img[^>]*>/", $newDescription, $match) !== FALSE) {  // Make sure it truely was a match  if ((count($match) != 0) && ($match[0] != "")) {    // Save the image    $theImage = $match[0];    // Remove the image from the description    $newDescription = str_replace($match[0], "", $newDescription);  }}echo "<tr><td>$theImage</td><td>~~~ItemPubShortDate~~~ ~~~ItemPubShortTime~~~<br>";echo "~~~ItemTitle~~~<br>";echo "$newDescription</td></tr>";echo "<tr><td colspan=\"2\"><hr></td></tr>";?>      ~~~EndItemsRecord~~~    </table>  </body></html><<<<<<<<<<<<<<<<<<<<<<<<<<<< END OF FILE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Example:     5 - Don't display items with duplicate titles or linksLevel:       AdvancedDescription: This example builds an array of the titles and links of each        item.  It then check to make sure that they haven't been used before.<<<<<<<<<<<<<<<<<<<<<<<<<<< START OF FILE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><?php$titleArray = Array();$linkArray = Array();?><html>  <head>    <meta http-equiv="content-type" content="text/html;charset=utf-8">    <title>~~~FeedTitle~~~</title>  </head>  <body>    <h1>~~~FeedTitle~~~</h1>    <p>~~~FeedDescription~~~</p>    <hr>    <table width="100%">      ~~~BeginItemsRecord~~~<?php$okayToDisplay = 1;//// Add the current item title and link to the arrays$titleArray[] = "~~~ItemTitle~~~";$linkArray[] = "~~~ItemLink~~~";for ($x = 0; $x < count($titleArray)-1; $x++) {  //  // Look to see if there were previously used.  if (("~~~ItemTitle~~~" == $titleArray[$x]) || ("~~~ItemLink~~~" == $linkArray[$x])) {    $okayToDisplay = 0;    break;  }}if ($okayToDisplay == 1) {?>      <tr><td>~~~ItemPubShortDate~~~ ~~~ItemPubShortTime~~~</td></tr>      <tr><td>~~~ItemTitle~~~</td></tr>      <tr><td>~~~ItemDescription~~~</td></tr>      <tr><td><hr></td></tr><?php}?>      ~~~EndItemsRecord~~~    </table>  </body></html><<<<<<<<<<<<<<<<<<<<<<<<<<<< END OF FILE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Example:     6 - Convert any <img> tags to XHTML 1.0 compliant format Level:       AdvancedDescription: XHTML 1.0 is much more strict about tags and attributes.  </img>       is not part of XHTML, so remove it.  <img> requires the ending slash       so make sure it is in the format <img ..... />.  Lastly make sure        there is a alt="" tag.<<<<<<<<<<<<<<<<<<<<<<<<<<< START OF FILE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><?phpFunction convertToXHTML_img($source) {  // Since <img> has not closing tag, remove all  $newDescription = str_replace("</img>", "", "There is no img tag");    // Use regular expressions to find <img ... >  if (preg_match_all("/<img[^>]*>/i", $newDescription, $match) !== FALSE) {    // Make sure it truely was a match    for ($x = 0; $x < count($match[0]); $x++) {      if ($match[0][$x] != "") {        // Save the image        $theImage = $match[0][$x];                // If the tag isn't closed with />, make it so        if (stristr(str_replace(" ", "", $theImage), "/>") === FALSE) {          $theImage = str_replace(">", "/>", $theImage);        }                // Check for the alt="" tag        if (stristr(str_replace(" ", "", $theImage), "alt=") === FALSE) {          $theImage = str_replace("/>", " alt=\"\" />", $theImage);        }                // Remove the image from the description        $newDescription = str_replace($match[0][$x], $theImage, $newDescription);      }    }  }    return $newDescription;}?><html>  <head>    <meta http-equiv="content-type" content="text/html;charset=utf-8">    <title>~~~FeedTitle~~~</title>  </head>  <body>    <h1>~~~FeedTitle~~~</h1>    <p><?php echo convertToXHTML_img("~~~FeedDescription~~~"); ?></p>    <hr>    <table width="100%">      ~~~BeginItemsRecord~~~      <tr><td>~~~ItemPubShortDate~~~ ~~~ItemPubShortTime~~~</td></tr>      <tr><td>~~~ItemTitle~~~</td></tr>      <tr><td><?php echo convertToXHTML_img("~~~ItemDescription~~~"); ?></td></tr>      <tr><td><hr></td></tr>      ~~~EndItemsRecord~~~    </table>  </body></html><<<<<<<<<<<<<<<<<<<<<<<<<<<< END OF FILE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Copyright 2006-2007 NotePage, Inc. All rights reserved$Id: rss2html-pro-examples.txt,v 3.0 2007/04/16 14:23:03 housley Exp $

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -