Zend_Feed-ConsumingAtomSingle.xml 1.6 KB

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