Zend_Feed-ConsumingAtom.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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>' <property>description</property> tag into
  12. two elements, <property>summary</property> and <property>content</property>, for that
  13. purpose.
  14. </para>
  15. <example id="zend.feed.consuming-atom.example.usage">
  16. <title>Basic Use of an Atom Feed</title>
  17. <para>
  18. Read an Atom feed and print the <property>title</property> and
  19. <property>summary</property> of each entry:
  20. </para>
  21. <programlisting language="php"><![CDATA[
  22. $feed = new Zend_Feed_Atom('http://atom.example.com/feed/');
  23. echo 'The feed contains ' . $feed->count() . ' entries.' . "\n\n";
  24. foreach ($feed as $entry) {
  25. echo 'Title: ' . $entry->title() . "\n";
  26. echo 'Summary: ' . $entry->summary() . "\n\n";
  27. }
  28. ]]></programlisting>
  29. </example>
  30. <para>
  31. In an Atom feed you can expect to find the following feed properties:
  32. </para>
  33. <itemizedlist>
  34. <listitem>
  35. <para>
  36. <property>title</property> - The feed's title, same as <acronym>RSS</acronym>'s
  37. channel title
  38. </para>
  39. </listitem>
  40. <listitem>
  41. <para>
  42. <property>id</property> - Every feed and entry in Atom has a unique identifier
  43. </para>
  44. </listitem>
  45. <listitem>
  46. <para>
  47. <property>link</property> - Feeds can have multiple links, which are
  48. distinguished by a <property>type</property> attribute
  49. </para>
  50. <para>
  51. The equivalent to <acronym>RSS</acronym>'s channel link would be
  52. <command>type="text/html"</command>. if the link is to an alternate version of
  53. the same content that's in the feed, it would have a
  54. <command>rel="alternate"</command> attribute.
  55. </para>
  56. </listitem>
  57. <listitem>
  58. <para>
  59. <property>subtitle</property> - The feed's description, equivalent to
  60. <acronym>RSS</acronym>' channel description
  61. </para>
  62. <para><property>author->name()</property> - The feed author's name</para>
  63. <para><property>author->email()</property> - The feed author's email address</para>
  64. </listitem>
  65. </itemizedlist>
  66. <para>
  67. Atom entries commonly have the following properties:
  68. </para>
  69. <itemizedlist>
  70. <listitem>
  71. <para><property>id</property> - The entry's unique identifier</para>
  72. </listitem>
  73. <listitem>
  74. <para>
  75. <property>title</property> - The entry's title, same as <acronym>RSS</acronym>
  76. item titles
  77. </para>
  78. </listitem>
  79. <listitem>
  80. <para>
  81. <property>link</property> - A link to another format or an alternate view of
  82. this entry
  83. </para>
  84. </listitem>
  85. <listitem>
  86. <para><property>summary</property> - A summary of this entry's content</para>
  87. </listitem>
  88. <listitem>
  89. <para>
  90. <property>content</property> - The full content of the entry; can be skipped if
  91. the feed just contains summaries
  92. </para>
  93. </listitem>
  94. <listitem>
  95. <para>
  96. <property>author</property> - with <property>name</property> and
  97. <property>email</property> sub-tags like feeds have
  98. </para>
  99. </listitem>
  100. <listitem>
  101. <para>
  102. <property>published</property> - the date the entry was published, in
  103. <acronym>RFC</acronym> 3339 format
  104. </para>
  105. </listitem>
  106. <listitem>
  107. <para>
  108. <property>updated</property> - the date the entry was last updated, in
  109. <acronym>RFC</acronym> 3339 format
  110. </para>
  111. </listitem>
  112. </itemizedlist>
  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. -->