Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

News Article: Date not showing on live site


Reply

12 Posts   1048 Views

Avatar
martimiz

2 October 2013 at 7:47am Forum Moderator, 1091 Posts

Hmmm, I don't see anything out of the ordinary - if Date is the actual fieldname defined in the NewsArticle (?) class.

The only thing I can think of now is that that fieldname (Date) might somehow conflict with something. What if you'd name it, say, DatePosted? I realize it's a long shot, but I remember seeing something like this before...

Avatar
IDOLYZ

2 October 2013 at 2:48pm Community Member, 40 Posts

Tried that too (i renamed it to ArticleDate) and it didn't work :(

Avatar
martimiz

3 October 2013 at 4:06am (Last edited: 3 October 2013 4:08am), Forum Moderator, 1091 Posts

OK, so:

- you made sure the Date field on the productionsite in the DB actually had a date in it
- you did dev/build?flush=1 after changing the fieldname Date to ArticleDate
- you made sure the new ArticleDate field in the DB actually had a date in it
- you did ?flush=1 after every template change
- the date actually is visible in the CMS field for the page

Then there really isn't much else I can think of from here :( Wonder what this does:

public function LatestNews($num=5) {
   $holder = ArticleHolder::get()->First();
   $pages = ($holder) ? ArticlePage::get()->filter('ParentID', $holder->ID)->sort('Date DESC')->limit($num) : false;

   if ($pages) foreach ($pages as $page) echo "*** {$page->Title}, {$page->Date} ***<br>";

   return $pages;
}

Avatar
IDOLYZ

30 October 2013 at 5:09pm (Last edited: 30 October 2013 7:11pm), Community Member, 40 Posts

Hi,

Sorry for late reply. Have been on holidays...

I used that code and the date shows correctly:

*** Chronically tight muscles stop sending pain signals, 2013-10-02 ***
*** Massage this Long Weekend?, 2013-09-24 ***
*** Pathology Testing, 2013-09-11 ***

How do I now get $page->Date to display on the page and RSS feed? Have tried $Date and $Date.Nice but doesn't work.

Thanks :)