phpDocumentor RSS
[ class tree: RSS ] [ index: RSS ] [ all elements ]

Source for file rss_sample_script.php

Documentation is available at rss_sample_script.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. //+----------------------------------------------------------------------+
  4. //| WAMP (XP-SP2/2.2/5.2/5.1.0)                                          |
  5. //+----------------------------------------------------------------------+
  6. //| Copyright(c) 2001-2008 Michael Wimmer                                |
  7. //+----------------------------------------------------------------------+
  8. //| Licence: GNU General Public License v3                               |
  9. //+----------------------------------------------------------------------+
  10. //| Authors: Michael Wimmer <flaimo@gmail.com>                           |
  11. //+----------------------------------------------------------------------+
  12. //
  13. // $Id$
  14.  
  15. /**
  16. @package RSS
  17. @category flaimo-php
  18. @filesource
  19. */
  20. include_once 'class.RSSBuilder.inc.php';
  21.  
  22. /* create the object - remember, not all attibutes are supported by every rss version. just hand over an empty string if you don't need a specific attribute */
  23. $encoding =(string) 'UTF-8';
  24. $about = (string) 'http://flaimo.com/';
  25. $title = (string) 'flaimo.com fake news';
  26. $description = (string) 'non existing news about my homepage';
  27. $image_link = (string) 'http://flaimo.com/small_logo.png';
  28. $category = (string) 'PHP Development'// (only rss 2.0)
  29. $cache = (string) 60// in minutes (only rss 2.0)
  30. $rssfile new RSSBuilder($encoding$about$title$description$image_link$category$cache);
  31.  
  32. /* if you want you can add additional Dublic Core data to the basic rss file (if rss version supports it) */
  33. $publisher = (string) 'Flaimo'// person, an organization, or a service
  34. $creator = (string) 'Flaimo'// person, an organization, or a service
  35. $date = (string) time();
  36. $language = (string) 'en';
  37. $rights = (string) 'Copyright © 2008 Flaimo.com';
  38. $coverage = (string) ''// spatial location , temporal period or jurisdiction
  39. $contributor = (string) 'Flaimo'// person, an organization, or a service
  40. $rssfile->addDCdata($publisher,    $creator$date$language,    $rights$coverage$contributor);
  41.  
  42. /* if you want you can add additional Syndication data to the basic rss file (if rss version supports it) */
  43. $period = (string) 'daily'// hourly / daily / weekly / ...
  44. $frequency = (int) 1// every X hours/days/...
  45. $base = (string) time()-10000;
  46. $rssfile->addSYdata($period$frequency$base);
  47.  
  48. /* data for a single RSS item */
  49. $about $link 'http://flaimo.com/sometext.php?somevariable=somevalue';
  50. $title = (string) 'A fake news headline';
  51. $description = (string) 'some abstract <b>text</b> about the fake news';
  52. $subject = (string) 'technology'// optional DC value
  53. $date = (string) time()// optional DC value
  54. $author = (string) 'Flaimo'// author of item
  55. $comments = (string) 'http://flaimo.com/sometext.php?somevariable=somevalue&amp;comments=1'// url to comment page rss 2.0 value
  56. $image = (string) 'http://flaimo.com/small_logo2.png'// optional mod_im value for dispaying a different pic for every item
  57. $rssfile->addRSSItem($about$title$link$description$subject$date,    $author$comments$image);
  58. $rssfile->addRSSItem($about$title$link$description$subject$date,    $author$comments$image);
  59. // add as much items as you want ...
  60.  
  61. $version '2.0'// 0.91 / 1.0 / 2.0
  62. $rssfile->outputRSS($version);
  63. /*
  64. // if you don't want to directly output the content, but instead work with the string (for example write it to a cache file) use
  65. $foo = $rssfile->getRSSOutput($version);
  66. */
  67.  
  68. /*
  69. // saves the xml file to the given path and returns the path + filename as a string
  70. $path = '';
  71. echo $rssfile->saveRSS($version, $path = '');
  72. */
  73.  
  74. ?>

Documentation generated on Sun, 05 Apr 2009 23:01:32 +0100 by phpDocumentor 1.4.1