Introducción a Zend Framework

 Aprendiendo Zend Framework


 Referencia de Zend Framework

  • Zend_Gdata
  • Zend_Http
  • Zend_InfoCard
  • Zend_Json
  • Zend_Layout
  • Zend_Ldap
  • Zend_Loader
  • Zend_Locale
  • Zend_Log
  • Zend_Mail
  • Zend_Markup
  • Zend_Measure
  • Zend_Memory
  • Zend_Mime
  • Zend_Navigation
  • Zend_Oauth
  • Zend_OpenId
  • Zend_Paginator
  • Zend_Pdf
  • Zend_ProgressBar
  • Zend_Queue
  • Zend_Reflection
  • Zend_Registry
  • Zend_Rest

  • Zend_Search_Lucene
  • Zend_Serializer
  • Zend_Server
  • Zend_Service
  • Zend_Session
  • Zend_Soap
  • Zend_Tag
  • Zend_Test
  • Zend_Text
  • Zend_TimeSync
  • Zend_Tool
  • Zend_Tool_Framework
  • Zend_Tool_Project
  • Zend_Translate
  • Zend_Uri
  • Zend_Validate
  • Zend_Version
  • Zend_View
  • Zend_Wildfire
  • Zend_XmlRpc
  • ZendX_Console_Process_Unix
  • ZendX_JQuery
  • Traducción al 26.9% - Actualizado el 2011-11-16 - Revisión 24249 - Versión ZF 1.11.x

    Capítulo 32. Zend_Feed

    32.1. Introduction

    Zend_Feed provides functionality for consuming RSS and Atom feeds. It provides a natural syntax for accessing elements of feeds, feed attributes, and entry attributes. Zend_Feed also has extensive support for modifying feed and entry structure with the same natural syntax, and turning the result back into XML. In the future, this modification support could provide support for the Atom Publishing Protocol.

    Programmatically, Zend_Feed consists of a base Zend_Feed class, abstract Zend_Feed_Abstract and Zend_Feed_Entry_Abstract base classes for representing Feeds and Entries, specific implementations of feeds and entries for RSS and Atom, and a behind-the-scenes helper for making the natural syntax magic work.

    In the example below, we demonstrate a simple use case of retrieving an RSS feed and saving relevant portions of the feed data to a simple PHP array, which could then be used for printing the data, storing to a database, etc.

    [Nota] Be aware

    Many RSS feeds have different channel and item properties available. The RSS specification provides for many optional properties, so be aware of this when writing code to work with RSS data.

    Ejemplo 32.1. Putting Zend_Feed to Work on RSS Feed Data

    // Fetch the latest Slashdot headlines
    try {
    $slashdotRss =
    } catch (
    Zend_Feed_Exception $e) {
    // feed import failed
    echo "Exception caught importing feed: {$e->getMessage()}\n";

    // Initialize the channel data array
    $channel = array(
    'title'       => $slashdotRss->title(),
    'link'        => $slashdotRss->link(),
    'description' => $slashdotRss->description(),
    'items'       => array()

    // Loop over each channel item and store relevant data
    foreach ($slashdotRss as $item) {
    $channel['items'][] = array(
    'title'       => $item->title(),
    'link'        => $item->link(),
    'description' => $item->description()

    digg delicious meneame google twitter technorati facebook