Yay it works! Thank you. But now the browser does not recognise the xml. I'm
probably missing something obvious as I'm new to feeds:

        <?xml version="1.0" encoding="utf-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/"; version="2.0">
  <channel>
    <title><![CDATA[Test Feed]]></title>
    <link>test.com</link>
    <description><![CDATA[First test feed]]></description>
    <pubDate>Mon, 10 Dec 2007 21:28:44 +0000</pubDate>
    <managingEditor>[EMAIL PROTECTED] (Jesse Meek)</managingEditor>
    <copyright>University, all rights reserved</copyright>
    <generator>Zend Framework Zend_Feed</generator>
    <language>en</language>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <item>
      <title><![CDATA[Item One]]></title>
      <link>test.com</link>
      <description><![CDATA[this is a test feed]]></description>
      <content:encoded><![CDATA[Hello, this is the
content]]></content:encoded>
      <pubDate>Mon, 10 Dec 2007 21:28:44 +0000</pubDate>
    </item>
  </channel>
</rss>




Simone Carletti wrote:
> 
> Hi Waigani,
> 
> entries must be an array of entries and each entry is an array itself.
> This is the right version of your code, you are missing one array
> statement.
> 
>  //Feed Array
> $feedArray = array(
>                 'title' => 'Test Feed',
>                 'link' => 'test.com',
>                 //'lastUpdate' => (0 == $posts->count() ? date('c',
> strtotime()) : date('c')),
>                 'charset' => 'utf-8',
>                 'description' => 'First test feed',
>                 'author' => 'Jesse',
>                 'email' => '[EMAIL PROTECTED]',
>                 'copyright' => 'University, all rights reserved',
>                 'generator' => 'Zend Framework Zend_Feed',
>                 'language' => 'en',
>                 'entries' => array(
>                     array(
>                         'title' => 'Item One',
>                         'link' => 'test.com',
>                         'description' => 'this is a test feed',
>                         'lastUpdate' => strtotime($post->updated),
>                         'content' => 'Hello, this is the content',
>                         )
>                 )
>         );
>  
> 
> 
> Waigani wrote:
>> 
>> Hi,
>> 
>> I'm trying to import an array as a feed and get the following error:
>> 
>> 'Zend_Feed_Builder_Exception' with message 'title key of source property
>> is missing' in …/Zend/Feed/Builder.php:368
>> 
>> Here is the code:
>> 
>>          //Feed Array
>>      $feedArray = array(
>>                      'title' => 'Test Feed',
>>                      'link' => 'test.com',
>>                      //'lastUpdate' => (0 == $posts->count() ? date('c', 
>> strtotime()) :
>> date('c')),
>>                      'charset' => 'utf-8',
>>                      'description' => 'First test feed',
>>                      'author' => 'Jesse',
>>                      'email' => '[EMAIL PROTECTED]',
>>                      'copyright' => 'University, all rights reserved',
>>                      'generator' => 'Zend Framework Zend_Feed',
>>                      'language' => 'en',
>>                      'entries' => array(
>>                              'title' => 'Item One',
>>                              'link' => 'test.com',
>>                              'description' => 'this is a test feed',
>>                              'lastUpdate' => strtotime($post->updated),
>>                              'content' => 'Hello, this is the content',
>>                      )
>>              );
>> 
>>              // create feed document
>>              $feed = Zend_Feed::importArray($feedArray, 'rss');
>>              $feed->send();
>> 
>> Here are the lines around 368 in …/Zend/Feed/Builder.php:
>> 
>> if (isset($row['source'])) {
>>                 $mandatories = array('title', 'url');
>>                 foreach ($mandatories as $mandatory) {
>>                     if (!isset($row['source'][$mandatory])) {
>>                         throw new Zend_Feed_Builder_Exception("$mandatory
>> key of source property is missing");
>>                     }
>>                 }
>>                 $entry->setSource($row['source']['title'],
>> $row['source']['url']);
>>             }
>> 
>> 
>> Now I've tried it with and without the 'source' array in the 'entries'
>> array. I've even tried cutting and pasting what is in the manual:
>> http://framework.zend.com/manual/en/zend.feed.importing.html
>> 
>> All produce exactly the same error. I'm using 1.03 libraries. Whats going
>> on?!?
>> 
>> Thanks,
>> Jess
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/%3A-exception-%27Zend_Feed_Builder_Exception%27-with-message-%27title-key-of-source-property-is-missing%27-tp14205926s16154p14265712.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to