|
|
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' => 'jesse@test.com',
'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.htmlAll produce exactly the same error. I'm using 1.03 libraries. Whats going on?!?
Thanks,
Jess
|
|
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' => 'jesse@test.com',
'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' => 'jesse@test.com',
'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.htmlAll produce exactly the same error. I'm using 1.03 libraries. Whats going on?!?
Thanks,
Jess
|
|
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>jesse.meek@test.com (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' => 'jesse@test.com',
'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' => 'jesse@test.com',
'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.htmlAll produce exactly the same error. I'm using 1.03 libraries. Whats going on?!?
Thanks,
Jess
|
|
Be sure you set the correct MIME Response Type to application/xml.
Waigani wrote
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>jesse.meek@test.com (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' => 'jesse@test.com',
'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' => 'jesse@test.com',
'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.htmlAll produce exactly the same error. I'm using 1.03 libraries. Whats going on?!?
Thanks,
Jess
|
|
The browser prompts me to download a file which has the same name as the action but no xml extension. When I add the xml extension and delete the white space before <?xml … the browser then reads the file as expected. How do I get Zend_Feed not doing this? Is there something I've missed?
Thanks,
Jess
Simone Carletti wrote
Be sure you set the correct MIME Response Type to application/xml.
Waigani wrote
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>jesse.meek@test.com (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' => 'jesse@test.com',
'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',
)
)
);
|
|
Be sure you do not add any ?> at the end of php-only files and you do not print any output before the XML.
Waigani wrote
The browser prompts me to download a file which has the same name as the action but no xml extension. When I add the xml extension and delete the white space before <?xml … the browser then reads the file as expected. How do I get Zend_Feed not doing this? Is there something I've missed?
Thanks,
Jess
Simone Carletti wrote
Be sure you set the correct MIME Response Type to application/xml.
Waigani wrote
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>jesse.meek@test.com (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' => 'jesse@test.com',
'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',
)
)
);
|
|
Yeah, checked both those things, no luck. I've a typo in my last message - I meant to say 'why is Zend_Feed not doing this'? Here is my full function (there must be something missing???):
function sendAction() {
// prepare an array that our feed is based on
$feedArray = array ('title' => 'Test Feed 123',
'link' => 'test.com',
//'lastUpdate' => (0 == $posts->count() ? date('c', strtotime()) : date('c')),
'charset' => 'utf-8',
'description' => 'First test feed',
'author' => 'Jesse Meek', 'email' => 'jesse.meek@test.com',
'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')
)
);
// create feed document
$feed = Zend_Feed::importArray ( $feedArray, 'rss' );
$feed->send();
$this->_helper->viewRenderer->setNoRender();
}
Simone Carletti wrote
Be sure you do not add any ?> at the end of php-only files and you do not print any output before the XML.
Waigani wrote
The browser prompts me to download a file which has the same name as the action but no xml extension. When I add the xml extension and delete the white space before <?xml … the browser then reads the file as expected. How do I get Zend_Feed not doing this? Is there something I've missed?
Thanks,
Jess
Simone Carletti wrote
Be sure you set the correct MIME Response Type to application/xml.
Waigani wrote
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>jesse.meek@test.com (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' => 'jesse@test.com',
'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',
)
)
);
|
|
What do you mean with this in 'why is Zend_Feed not doing this'?
Waigani wrote
Yeah, checked both those things, no luck. I've a typo in my last message - I meant to say 'why is Zend_Feed not doing this'? Here is my full function (there must be something missing???):
function sendAction() {
// prepare an array that our feed is based on
$feedArray = array ('title' => 'Test Feed 123',
'link' => 'test.com',
//'lastUpdate' => (0 == $posts->count() ? date('c', strtotime()) : date('c')),
'charset' => 'utf-8',
'description' => 'First test feed',
'author' => 'Jesse Meek', 'email' => 'jesse.meek@test.com',
'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')
)
);
// create feed document
$feed = Zend_Feed::importArray ( $feedArray, 'rss' );
$feed->send();
$this->_helper->viewRenderer->setNoRender();
}
Simone Carletti wrote
Be sure you do not add any ?> at the end of php-only files and you do not print any output before the XML.
Waigani wrote
The browser prompts me to download a file which has the same name as the action but no xml extension. When I add the xml extension and delete the white space before <?xml … the browser then reads the file as expected. How do I get Zend_Feed not doing this? Is there something I've missed?
Thanks,
Jess
Simone Carletti wrote
Be sure you set the correct MIME Response Type to application/xml.
Waigani wrote
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>jesse.meek@test.com (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' => 'jesse@test.com',
'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',
)
)
);
|
|