Zend_Feed-ConsumingAtom.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.feed.consuming-atom">
  4. <title>Consuming an Atom Feed</title>
  5. <para>
  6. <classname>Zend_Feed_Atom</classname> is used in much the same way as
  7. <classname>Zend_Feed_Rss</classname>. It provides the same access to feed-level properties
  8. and iteration over entries in the feed. The main difference is in the structure of the Atom
  9. protocol itself. Atom is a successor to <acronym>RSS</acronym>; it is more generalized
  10. protocol and it is designed to deal more easily with feeds that provide their full content
  11. inside the feed, splitting <acronym>RSS</acronym>' <code>description</code> tag into two
  12. elements, <code>summary</code> and <code>content</code>, for that purpose.
  13. </para>
  14. <example id="zend.feed.consuming-atom.example.usage">
  15. <title>Basic Use of an Atom Feed</title>
  16. <para>
  17. Read an Atom feed and print the <code>title</code> and <code>summary</code> of each
  18. entry:
  19. </para>
  20. <programlisting language="php"><![CDATA[
  21. $feed = new Zend_Feed_Atom('http://atom.example.com/feed/');
  22. echo 'The feed contains ' . $feed->count() . ' entries.' . "\n\n";
  23. foreach ($feed as $entry) {
  24. echo 'Title: ' . $entry->title() . "\n";
  25. echo 'Summary: ' . $entry->summary() . "\n\n";
  26. }
  27. ]]></programlisting>
  28. </example>
  29. <para>
  30. In an Atom feed you can expect to find the following feed properties:
  31. </para>
  32. <para>
  33. <itemizedlist>
  34. <listitem>
  35. <para>
  36. <code>title</code> - The feed's title, same as <acronym>RSS</acronym>'s channel
  37. title
  38. </para>
  39. </listitem>
  40. <listitem>
  41. <para><code>id</code> - Every feed and entry in Atom has a unique identifier</para>
  42. </listitem>
  43. <listitem>
  44. <para>
  45. <code>link</code> - Feeds can have multiple links, which are distinguished by a
  46. <code>type</code> attribute
  47. </para>
  48. <para>
  49. The equivalent to <acronym>RSS</acronym>'s channel link would be
  50. <code>type="text/html"</code>. if the link is to an alternate version of the
  51. same content that's in the feed, it would have a <code>rel="alternate"</code>
  52. attribute.
  53. </para>
  54. </listitem>
  55. <listitem>
  56. <para>
  57. <code>subtitle</code> - The feed's description, equivalent to
  58. <acronym>RSS</acronym>' channel description
  59. </para>
  60. <para><code>author->name()</code> - The feed author's name</para>
  61. <para><code>author->email()</code> - The feed author's email address</para>
  62. </listitem>
  63. </itemizedlist>
  64. </para>
  65. <para>
  66. Atom entries commonly have the following properties:
  67. </para>
  68. <para>
  69. <itemizedlist>
  70. <listitem>
  71. <para><code>id</code> - The entry's unique identifier</para>
  72. </listitem>
  73. <listitem>
  74. <para>
  75. <code>title</code> - The entry's title, same as <acronym>RSS</acronym> item
  76. titles
  77. </para>
  78. </listitem>
  79. <listitem>
  80. <para>
  81. <code>link</code> - A link to another format or an alternate view of this entry
  82. </para>
  83. </listitem>
  84. <listitem>
  85. <para><code>summary</code> - A summary of this entry's content</para>
  86. </listitem>
  87. <listitem>
  88. <para>
  89. <code>content</code> - The full content of the entry; can be skipped if the feed
  90. just contains summaries
  91. </para>
  92. </listitem>
  93. <listitem>
  94. <para>
  95. <code>author</code> - with <code>name</code> and <code>email</code> sub-tags
  96. like feeds have
  97. </para>
  98. </listitem>
  99. <listitem>
  100. <para>
  101. <code>published</code> - the date the entry was published, in
  102. <acronym>RFC</acronym> 3339 format
  103. </para>
  104. </listitem>
  105. <listitem>
  106. <para>
  107. <code>updated</code> - the date the entry was last updated, in
  108. <acronym>RFC</acronym> 3339 format
  109. </para>
  110. </listitem>
  111. </itemizedlist>
  112. </para>
  113. <para>
  114. For more information on Atom and plenty of resources, see
  115. <ulink url="http://www.atomenabled.org/">http://www.atomenabled.org/</ulink>.
  116. </para>
  117. </sect1>
  118. <!--
  119. vim:se ts=4 sw=4 et:
  120. -->