Modifying Feed and Entry structures

Custom Feed and Entry Classes

Finally, you can extend the Zend_Feed classes if you'd like to provide your own format or niceties like automatic handling of elements that should go into a custom namespace.

Here is an example of a custom Atom entry class that handles its own myns: namespace entries. Note that it also makes the registerNamespace() call for you, so the end user doesn't need to worry about namespaces at all.

Example #1 Extending the Atom Entry Class with Custom Namespaces

  1. /**
  2. * The custom entry class automatically knows the feed URI (optional) and
  3. * can automatically add extra namespaces.
  4. */'http://www.example.com/myfeed/''myns',
  5.                                      'http://www.example.com/myns/1.0''myUpdated':
  6.                 // Translate myUpdated to myns:updated.
  7. 'myns:updated''myUpdated':
  8.                 // Translate myUpdated to myns:updated.
  9. 'myns:updated''myUpdated':
  10.                 // Translate myUpdated to myns:updated.
  11. 'myns:updated'

Then to use this class, you'd just instantiate it directly and set the myUpdated property:

  1. span style="color: #ff0000;">'2005-04-19T15:30';
  2.  
  3. // method-style call is handled by __call function
  4. // property-style call is handled by __get function

Modifying Feed and Entry structures