22404 Posts in 6883 Topics by 2748 members
|Go to End|
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!
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
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"
|Go to Top|