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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

News Article: Date not showing on live site


Go to End


12 Posts   3481 Views

Avatar
IDOLYZ

Community Member, 40 Posts

24 September 2013 at 8:44pm

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

Community Member, 40 Posts

30 September 2013 at 11:52am

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

Avatar
martimiz

Forum Moderator, 1391 Posts

30 September 2013 at 11:43pm

Edited: 30/09/2013 11:45pm

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

Community Member, 40 Posts

1 October 2013 at 1:25pm

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

Forum Moderator, 1391 Posts

1 October 2013 at 9:43pm

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

Community Member, 40 Posts

1 October 2013 at 9:45pm

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

Avatar
martimiz

Forum Moderator, 1391 Posts

1 October 2013 at 10:33pm

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

Community Member, 40 Posts

2 October 2013 at 1:15am

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