PDA

View Full Version : Displaying Date in RSS Feed



matt blank
02-14-2007, 12:20 PM
Hi,

I'm trying to use this script:
http://www.dynamicdrive.com/dynamicindex18/rssdisplaybox/index.htm

This is the RSS feed I've made (which I don't want to change):
http://www.mattblank.com/rss/rss.xml

And this is how it displays on the page:
http://www.mattblank.com/rss/demo.htm

Although I'm using the default template which therefore should show this:

<DIV class="rsscontainer">
<div class="rssdate"><?php echo $item->get_date(); ?></div>
<div class="rsstitle"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></div>
<div class="rssdescription"><?php echo $item->get_description(); ?></div><br/><br/>
</DIV>

It does not display the date.

Can anyone help me please? It's really frustrating as I really want it to work, but don't want to change the way my RSS Feed is setup.

Many thanks in advance,
Matt

jscheuer1
02-14-2007, 07:02 PM
It does here.


26 January 2007, 12:00 am
This Is My Title
Here is my description


25 January 2007, 12:00 am
This Is My Title
Here is my description


24 January 2007, 12:00 am
This Is My Title
Here is my description


23 January 2007, 12:00 am
This Is My Title
Here is my description


22 January 2007, 12:00 am
This Is My Title
Here is my description

matt blank
02-14-2007, 07:07 PM
Hi John,

Since posting I changed the RSS to say pubDate instead of Date and that then displayed it. But is it now possible to swap the date around, have a th/rd after the date and to NOT display the time?

So instead of: 26 January 2007, 12:00 am
To have: January 26th 2007

Thanks!
Matt

jscheuer1
02-14-2007, 07:30 PM
I'm not much up on PHP but, this (or similar) might do it:


<div class="rssdate"><?php echo $item->get_date('M d Y'); ?></div>

The exact syntax in PHP may be different. To get the th or whatever (depending upon the date number) in there might be easier with javascript. You could also experiment with a capital D to see what value that returns (probably the Day name).

matt blank
02-19-2007, 10:14 AM
Thanks John!! I played about with what you've suggested and figured it out.

Many thanks for your help!
Matt