21490 Posts in 5783 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 710 Views |
-
"Today is..."

10 March 2010 at 8:35am
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!
-
Re: "Today is..."

10 March 2010 at 9:40am
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:
or$Now.Nice
$Now.Long
Look here for other options: http://doc.silverstripe.org/doku.php?id=ssdatetimeIf 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.ssSee 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_titleCheers,
- Luke
| 710 Views | ||
|
Page:
1
|
Go to Top |


