| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- Reviewed: no -->
- <sect1 id="zend.feed.consuming-atom-single-entry">
- <title>Consuming a Single Atom Entry</title>
- <para>
- Single Atom <command><entry></command> elements are also valid by themselves. Usually
- the <acronym>URL</acronym> for an entry is the feed's <acronym>URL</acronym> followed by
- <command>/<entryId></command>, such as
- <filename>http://atom.example.com/feed/1</filename>, using the example
- <acronym>URL</acronym> we used above.
- </para>
- <para>
- If you read a single entry, you will still have a <classname>Zend_Feed_Atom</classname>
- object, but it will automatically create an "anonymous" feed to contain the entry.
- </para>
- <example id="zend.feed.consuming-atom-single-entry.example.atom">
- <title>Reading a Single-Entry Atom Feed</title>
- <programlisting language="php"><![CDATA[
- $feed = new Zend_Feed_Atom('http://atom.example.com/feed/1');
- echo 'The feed has: ' . $feed->count() . ' entry.';
- $entry = $feed->current();
- ]]></programlisting>
- </example>
- <para>
- Alternatively, you could instantiate the entry object directly if you know you are accessing
- an <command><entry></command>-only document:
- </para>
- <example id="zend.feed.consuming-atom-single-entry.example.entryatom">
- <title>Using the Entry Object Directly for a Single-Entry Atom Feed</title>
- <programlisting language="php"><![CDATA[
- $entry = new Zend_Feed_Entry_Atom('http://atom.example.com/feed/1');
- echo $entry->title();
- ]]></programlisting>
- </example>
- </sect1>
- <!--
- vim:se ts=4 sw=4 et:
- -->
|