Jump to:

21490 Posts in 5783 Topics by 2622 members

General Questions

SilverStripe Forums » General Questions » "Today is..."

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 710 Views
  • jseth
    Avatar
    Community Member
    98 Posts

    "Today is..." Link to this post

    I've read other posts about adding a date to a template, but all I would like to do is add a line to my home page that reads "Today is..." with the date. I don't want it on all the pages, and I'm not quite sure how or where to go about inserting the code (or what the code should be). Does anyone know how to do this? Thanks!

  • Anonymous user
    Avatar
    Community Member
    1 Post

    Re: "Today is..." Link to this post

    To insert the date, put the following into your template (eg: themes/tutorial/templates/Layout/Page.ss)

    Today is $Now

    You can format it better by using something like:

    $Now.Nice

    or

    $Now.Long


    Look here for other options: http://doc.silverstripe.org/doku.php?id=ssdatetime

    If you only want the date to show on certain pages, then you should probably create a new page type for your homepage.
    Then the date code will go into something like themes/tutorial/templates/Layout/HomePage.ss instead of Page.ss

    See the tutorial (linked below) and look for the heading: "Using a different template for the home page"
    http://doc.silverstripe.org/doku.php?id=tutorial:1-building-a-basic-site&s=tutorial#inserting_the_page_title

    Cheers,
    - Luke

    710 Views
Page: 1
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.