Miscellaneous Code
  Home arrow Miscellaneous Code arrow RSS 2.0 generation class
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MISCELLANEOUS CODE

RSS 2.0 generation class
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 3
    2006-02-12

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Powerful PHP class for RSS 2.0 feed generation.

    By : mgalesic

    Simple example:

    <?php
    include('class.rss.php');
    $rss = new rss('utf-8');

    $rss->channel('RSStitle', 'http://www.yoursite.com', 'Description of RSS channel');
    $rss->language('en-us');
    $rss->copyright('Copyright by yourSiteName 2006');
    $rss->managingEditor('email@yoursite.com');
    $rss->category('CategoryName');

    $rss->startRSS();

    for($i = 1; $i < 10; $i++){
    $rss->itemTitle('News ' . $i);
    $rss->itemLink('http://www.yoursite.com/news.php?id=' . $i);
    $rss->itemDescription('This is short news description number ' . $i);
    $rss->itemAuthor('email@yoursite.com');
    $rss->itemGuid('http://www.yoursite.com/news.php?id=' . $i);
    $rss->itemSource('YourSiteName', 'http://www.yoursite.com/rss/rss.xml');

    $rss->addItem();
    }

    echo $rss->RSSdone();

    ?>

    Prototypes and description:
    ---------------------------

    Full documentation of RSS 2.0 standard you can find at http://blogs.law.harvard.edu/tech/rss

    Legends:
    --------
    *R - required function
    *O - optional function
    = '' - optional parameter inside the function


    - $rss = new rss($encoding = '');

    - function channel($title, $link, $description);
    *R

    - function language($language);
    *O

    - function copyright($copyright);
    *O
    Copyright notice for content in the channel

    - function managingEditor($managingEditor);
    *O
    Email address for person responsible for editorial content

    - function webMaster($webMaster);
    *O
    Email address for person responsible for technical issues relating to channel

    - function pubDate($pubDate);
    *O
    The publication date for the content in the channel
    All date-times in RSS conform to the Date and Time Specification of RFC 822

    - function lastBuildDate($lastBuildDate);
    *O
    The last time the content of the channel changed

    - function category($category, $domain = '');
    *O
    Specify one or more categories that the channel belongs to
    Follows the same rules as the function itemCategory();

    - function cloud($domain, $port, $path, $registerProcedure, $protocol);
    *O
    Allows processes to register with a cloud to be notified of updates to the channel,
    implementing a lightweight publish-subscribe protocol for RSS feeds

    - function ttl($ttl);
    *O
    ttl stands for time to live
    It's a number of minutes that indicates how long a channel can be cached before refreshing from the source

    - function image($url, $title, $link, $width = '', $height = '', $description = '');
    *O
    Specifies a GIF, JPEG or PNG image that can be displayed with the channel

    - function textInput($title, $description, $name, $link);
    *O
    Specifies a text input box that can be displayed with the channel

    - function skipHours();
    *O
    function can take any numner of parameters
    See the specification for skipHours tag

    - function skipDays();
    *O
    function can take any numner of parameters
    See the specification for skipDays tag

    - function startRSS($path = '.', $filename = 'rss');
    *O
    function take path and filename for creating an XML file
    It has to be called after all aabove function but before any item function
    In default it will create rss.xml file in current directory


    Item functions:
    ---------------

    A channel may contain any number of item functions.
    An item may represent a "story" much like a story in a newspaper or magazine
    If so its description is a synopsis of the story, and the link points to the full story.
    An item may also be complete in itself, if so, the description contains the text,
    and the link and title may be omitted.
    All elements of an item are optional, however at least one of title or description must be present.


    - function itemTitle($title)
    *R / *O
    The title of the item

    - function itemLink($link);
    *O
    The URL of the item

    - function itemDescription($description);
    *R / *O
    The item synopsis

    - function itemAuthor($author);
    *O
    Email address of the author of the item

    - function itemCategory($category, $domain = '');
    *O
    Includes the item in one or more categories.
    It has one optional attribute, domain, a string that identifies a categorization taxonomy
    The value of the element is a forward-slash-separated string that identifies a hierarchic location in the indicated taxonomy.
    Processors may establish conventions for the interpretation of categories.
    You may include as many category elements as you need to, for different domains,
    and to have an item cross-referenced in different parts of the same domain.

    - function itemComments($comments);
    *O
    URL of a page for comments relating to the item

    - function itemEnclosure($enclosure);
    *O
    Describes a media object that is attached to the item

    - function itemGuid($guid, $isPermaLink = '');
    *O
    A string that uniquely identifies the item
    If the guid element has an attribute named "isPermaLink" with a value of true,
    the reader may assume that it is a permalink to the item, that is, a url that can be opened in a Web browser,
    that points to the full item described by the <item> element

    - function itemPubDate($pubDate);
    *O
    Indicates when the item was published

    - function itemSource($source, $url);
    *O
    The RSS channel that the item came from

    - function addItem();
    *R
    You place this function after all item functions.
    You can create unlimited number of items.

    - function RSSdone();
    *R
    This is the last you write in your code

    - function clearRSS();
    *R / *O
    You write this function if You want to create a new RSS channel without reinitializing the class










    Click to Download File



    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Miscellaneous Code Articles
    More By Codewalkers

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! "ebook: Exploring IBM SOA Technology & Practice

    Learn field-tested SOA principles, methodology, technology and implementation from the global SOA market leader - in a new e-book by an IBM SOA expert. Written by IBM Certified SOA Solution Designer Bobby Woolf, "Exploring IBM SOA Technology & Practice" is the ultimate insider's guide to SOA - a PDF e-book packed cover to cover with IBM's specific advice on how to make your SOA implementation a success.
    FREE! Go There Now!


    NEW! Achieving True Agility -- How process can change the behavior of your tools

    Achieving true agility is a never-ending effort. We will showcase how you can become agile incrementally, a few practices at the time.Which practices should any agile team strive to adopt? What additional practices should you consider based on your needs to scale? Adopting practices are however made much easier with the right tool support. What about if your tools adapt to your practices? We will take a look at how the Jazz technology can be leveraged to make your process change the behavior of your tools.
    FREE! Go There Now!


    NEW! Discovering the value of WebSphere Process Server

    WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies.
    FREE! Go There Now!


    NEW! Download a free trial of WebSphere Business Modeler Advanced V6.1.1

    Visit IBM developerWorks to download a free trial version of WebSphere Business Modeler Advanced V6.1.1, IBM’s premier business process modeling and analysis tool for business users that offers process modeling, simulation, and analysis capabilities. IBM WebSphere Business Modeler helps you visualize, understand, and document business processes for continuous improvement.
    FREE! Go There Now!


    NEW! Rational Talks to You:Per Kroll on Rational Method Composer Plug-in customization

    Join this Rational Talks to You teleconference on December 11 at 1:00 pm ET to get tips on building your own plugins with Rational Method Composer. Get your questions answered!
    FREE! Go There Now!


    NEW! Run your first CICS application on a PC using TXSeries for Windows

    Learn the basics of the IBM Customer Information Control System (CICS). With a hands-on exercise, learn how to get your first CICS application up and running on your desktop using TXSeries V6.1 for Windows. The tutorial shows you how to download and install a free trial version of TXSeries V6.1.
    FREE! Go There Now!


    NEW! Trial download: IBM Lotus Forms V3.0

    Get a free trial download of IBM Lotus Forms V3.0 (formerly Workplace Forms), which provides a zero-footprint eForms solution to help you automate and move forms-based business processes off the desktop and onto the Web. With Lotus Forms, you can extend applications beyond the firewall by creating a single electronic form document ready for use in both thick and Web 2.0 thin client format.
    FREE! Go There Now!


    NEW! Using Rational Business Developer to enhance your developer productivity

    Join this Rational Talks to You teleconference, to hear how Enterprise Generation Language (EGL) eliminates the need for tedious and error-prone low level coding, so developers can focus on business requirements. EGL extends the Rational software development platform with a simplified programming language that enables developers who have little or no experience with Java, Web technologies or Service Oriented Architecture, to create enterprise-class applications and services quickly and easily. It also allows developers who may have little or no mainframe programming experience to quickly create traditional mainframe components.
    FREE! Go There Now!


    NEW! Webcast: Introducing the new Information Server and Solutions community: LeverageInformation

    User communities play an important role in communication and collaboration around products, solutions and other areas of special interest to members. Successful communities are able to provide the right mix of content and services to deliver a value proposition that resonates with each audience. Join Tom Inman, VP of Marketing for Information and Platform Solutions as he introduces the new LeverageINFORMATION community. During this webcast, learn about the value provided by the community and how customers and partners derive value from the community in addressing their own technical and business challenges.
    FREE! Go There Now!


    NEW! Whitepaper: Delivering SOA solutions: service lifecycle management

    The unprecedented scope of a service-oriented architecture (SOA) initiative brings to the forefront a number of management and governance issues that were sidestepped in the past. The key to a successful SOA implementation is managing and governing activities throughout the entire SOA delivery lifecycle by ensuring that services conform to the needs of all of the business’s stakeholders. Learn how service lifecycle management allows the business to ensure that the process by which services are defined, created, tested, deployed, optimized and retired is manageable, repeatable and auditable.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    MISCELLANEOUS CODE ARTICLES

    - A Web App Based on a Model for the CodeIgnit...
    - Completing a Model for the CodeIgniter PHP F...
    - Validating Input Data with the CodeIgniter P...
    - Deleting Database Records with the CodeIgnit...
    - Inserting Database Records with a CodeIgnite...
    - Fetching Database Rows with a Model for the ...
    - Model Data and Validation Rules for a Generi...
    - Building a Generic Model for the CodeIgniter...
    - upload image to database sql
    - Random Password Generator
    - BCroot, get the root of a number with BC fun...
    - Find pi in a high precision
    - [PHP5] FORMCHECKER : data validation
    - SPL and ITERATOR : examples
    - Xml with Rss Feeds





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT