Zend_Feed-ConsumingAtomSingle.xml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.feed.consuming-atom-single-entry">
  4. <title>Consuming a Single Atom Entry</title>
  5. <para>
  6. Single Atom <code>&lt;entry&gt;</code> elements are also valid by themselves. Usually the
  7. URL for an entry is the feed's URL followed by <code>/&lt;entryId&gt;</code>, such as
  8. <code>http://atom.example.com/feed/1</code>, using the example URL we used above.
  9. </para>
  10. <para>
  11. If you read a single entry, you will still have a <classname>Zend_Feed_Atom</classname>
  12. object, but it will automatically create an "anonymous" feed to contain the entry.
  13. </para>
  14. <example id="zend.feed.consuming-atom-single-entry.example.atom">
  15. <title>Reading a Single-Entry Atom Feed</title>
  16. <programlisting language="php"><![CDATA[
  17. $feed = new Zend_Feed_Atom('http://atom.example.com/feed/1');
  18. echo 'The feed has: ' . $feed->count() . ' entry.';
  19. $entry = $feed->current();
  20. ]]></programlisting>
  21. </example>
  22. <para>
  23. Alternatively, you could instantiate the entry object directly if you know you are accessing
  24. an <code>&lt;entry&gt;</code>-only document:
  25. </para>
  26. <example id="zend.feed.consuming-atom-single-entry.example.entryatom">
  27. <title>Using the Entry Object Directly for a Single-Entry Atom Feed</title>
  28. <programlisting language="php"><![CDATA[
  29. $entry = new Zend_Feed_Entry_Atom('http://atom.example.com/feed/1');
  30. echo $entry->title();
  31. ]]></programlisting>
  32. </example>
  33. </sect1>
  34. <!--
  35. vim:se ts=4 sw=4 et:
  36. -->