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


Go to End
Reply

12 Posts   1054 Views

Avatar
IDOLYZ

24 September 2013 at 8:44pm Community Member, 40 Posts

Hi,

I have a site with news articles. On the test site hosted on my server (http://preview.bbcreativeperth.com.au/tsow/resources/news-and-newsletters/) it works fine, but when i upload it to the live server hosted on Crazy Domains (http://www.thesourceofwellness.com.au/resources/news-and-newsletters) the article date doesn't show. The code is exactly the same and I checked the phpinfo and most appear the same.

It's also the same for the rss feed. Any ideas on what could be the issue?

Cheers,
Ben

Avatar
IDOLYZ

30 September 2013 at 11:52am Community Member, 40 Posts

Anyone got any ideas? Really need a solution ASAP... thanks!

Avatar
martimiz

30 September 2013 at 11:43pm (Last edited: 30 September 2013 11:45pm), Forum Moderator, 1095 Posts

Hard to tell without any code samples... How's the date represented in your template? Any custom functionality involved?

[EDIT] As you posted this in the Other modules section - are you using some third party News module?

Avatar
IDOLYZ

1 October 2013 at 1:25pm Community Member, 40 Posts

Hi,

I didn't know which forum to post it in... but it uses the standard news page type code from the tutorial (http://doc.silverstripe.org/framework/en/tutorials/2-extending-a-basic-site/)

The date works in the CMS and is stored, but when I use the code $Date.Nice in the template, nothing shows. I know the code is right because it works on my localhost and testing server, just not the live site hosted on CrazyDomains.

Cheers for getting back to me.

Avatar
martimiz

1 October 2013 at 9:43pm Forum Moderator, 1095 Posts

I suppose there might be something in your server config not playing nice...

To rule out some things: if you replace $Date.Nice with $Date in your template, do you then see the (raw) date?

Avatar
IDOLYZ

1 October 2013 at 9:45pm Community Member, 40 Posts

No it doesn't show the raw date either. I did try that.

Avatar
martimiz

1 October 2013 at 10:33pm Forum Moderator, 1095 Posts

Are you sure both sites are the same? As I'm seeing more differences, for instance:

The 'posted on' paragraph is missing from the article itself on the live site
The 'back to' button is missing its title in the article on the live site

It could be some small code change triggering this... Can you post the template code?

Avatar
IDOLYZ

2 October 2013 at 1:15am Community Member, 40 Posts

The functionality was the same, i had just made a couple of small changes to the live site. I have now uploaded the latest scripts to the test site and it still shows the date...

The layout template code is:

<% loop LatestNews %>
   <article>
      <h5><a href="$Link" title="Read more">$Title</a> &nbsp; <span><em>$Date.Nice</em> &nbsp; $Content.FirstSentence</span></h5>
   </article>
<% end_loop %>

And the code in mysite/ArticleHolder.php is:

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

Go to Top