Jump to:

10979 Posts in 2722 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » News Article: Date not showing on live site

Discuss all other Modules here.

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

Page: 1 2
Go to End
Author Topic: 998 Views
  • IDOLYZ
    Avatar
    Community Member
    40 Posts

    News Article: Date not showing on live site Link to this post

    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

  • IDOLYZ
    Avatar
    Community Member
    40 Posts

    Re: News Article: Date not showing on live site Link to this post

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

  • martimiz
    Avatar
    Forum Moderator
    1078 Posts

    Re: News Article: Date not showing on live site Link to this post

    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?

  • IDOLYZ
    Avatar
    Community Member
    40 Posts

    Re: News Article: Date not showing on live site Link to this post

    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.

  • martimiz
    Avatar
    Forum Moderator
    1078 Posts

    Re: News Article: Date not showing on live site Link to this post

    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?

  • IDOLYZ
    Avatar
    Community Member
    40 Posts

    Re: News Article: Date not showing on live site Link to this post

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

  • martimiz
    Avatar
    Forum Moderator
    1078 Posts

    Re: News Article: Date not showing on live site Link to this post

    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?

  • IDOLYZ
    Avatar
    Community Member
    40 Posts

    Re: News Article: Date not showing on live site Link to this post

    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;
    }

    998 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.