See my posted code sample, works fine as is.

Best,

Andriesss

Bill YILDIRIM schreef:
Andries,
I have changed the code like this
            list($date, $hours) = split(' ', $newstime);
            list($year,$month,$day) = split('-',$date);
            list($hour,$min,$sec) = split(':',$hours);
*$date = mktime($hour, $min, $sec, $month, $day, $year); * $clean['title'] = $foo;
            $clean['description'] = $foo;
$clean['link'] = SITE_DOMAIN.'/view/index/product/'.$linkGenerator->linkgen($thisProduct->productTitle,$thisProduct->productID);
            *$clean['published'] = $date;*
$clean['guid'] = SITE_DOMAIN.'/view/index/product/'.$linkGenerator->linkgen($thisProduct->productTitle,$thisProduct->productID);
            $feed['entries'][] = array(
'description' => $clean['description'],
                                            'guid' => $clean['guid'],
                                            'link' => $clean['link'],
*'published' => $clean['published'], *
                                            'title' => $clean['title']
                                            );
still source of the feed shows like this!!!
        <item>
<title><![CDATA[Sony Vaio VGN-FZ21Z Laptop PC (VGNFZ21Z.CEK) + 15.4inch Laptop Case + USB Mini Mouse + Norton Internet Security 2008 (OEM) + Logitech Z-10 Speaker]]></title> <link>http://xxxxxxx/view/index/product/Sony-Vaio-VGNFZ21Z-Laptop-PC-VGNFZ21ZCEK--154inch-Laptop-Case--USB-Mini-Mouse--Norton-Internet-Security-2008-OEM--Logitech-Z10-Speaker-p-0010704354705113</link> <guid>http://xxxxxx/view/index/product/Sony-Vaio-VGNFZ21Z-Laptop-PC-VGNFZ21ZCEK--154inch-Laptop-Case--USB-Mini-Mouse--Norton-Internet-Security-2008-OEM--Logitech-Z10-Speaker-p-0010704354705113</guid> <description><![CDATA[Sony Vaio VGN-FZ21Z Laptop PC (VGNFZ21Z.CEK) + 15.4inch Laptop Case + USB Mini Mouse + Norton Internet Security 2008 (OEM) + Logitech Z-10 Speaker]]></description>
            *<pubDate>Sat, 26 Jan 2008 11:58:37 +0000</**pubDate>*
        </item>

how can this be possible?


Andries Seutens wrote:
Another thing, the key for publication date is "published" and not pudDate. So use:

$feedData = array(
    'title'       => 'title of the feed',
    'link'        => 'canonical url to the feed',
    'lastUpdate'  => mktime(1, 1, 1, 1, 1, 2007),
    'charset'     => 'utf-8',
    'published'   => mktime(null, null, null, 1, 1, 2007),
    'entries'     => array(
        array(
          'title'        => 'title of the feed entry',
          'link'         => 'url to a feed entry',
          'description'  => 'short version of a feed entry',
          'content'      => 'long version',
          'lastUpdate'   => mktime(null, null, null, 1, 1, 2007),
          'published'    => mktime(null, null, null, 1, 1, 2007)
        )
    )
);

$rssFeed = Zend_Feed::importArray($feedData, 'rss');
$rssFeed->send();

Best,

Andries

Andries Seutens schreef:
Hello Bill,

Zend_Feed's date format expects a timestamp format. It will automaticly convert it to the RFC format. So instead of providing a string date, provide a timestamp, like so:

$feedData = array(
    'title'       => 'title of the feed',
    'link'        => 'canonical url to the feed',
    'lastUpdate'  => mktime(1, 1, 1, 1, 1, 2007),
    'charset'     => 'utf-8',
    'entries'     => array(
        array(
          'title'        => 'title of the feed entry',
          'link'         => 'url to a feed entry',
          'description'  => 'short version of a feed entry',
          'content'      => 'long version',
          'lastUpdate'   => mktime(null, null, null, 1, 1, 2007)
        )
    )
);

$rssFeed = Zend_Feed::importArray($feedData, 'rss');
echo $rssFeed;

Best,

Andries

Bill YILDIRIM schreef:
Hi there,
I have been playing with Zend_Feed since yesterday. I finally managed to create my first rss feed. I have on problem though. This is how I convert mysql datetime to rss date time
           $newstime = $thisProduct->addDate;
           list($date, $hours) = split(' ', $newstime);
           list($year,$month,$day) = split('-',$date);
           list($hour,$min,$sec) = split(':',$hours);

           //returns the date ready for the rss feed
$date = date('r',mktime($hour, $min, $sec, $month, $day, $year)); but when I reach the feed, it shows the current date and time?
does it suppose to work like this?

Thanks
B





------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.19.11/1244 - Release Date: 25/01/2008 19:44

Reply via email to