Page 1 of 1
Adding a date to web pages
Posted: 31 Oct 2011 12:32
by RogerF
The Web Site Wizard offers an Advanced setting at Step 8 -- add HTML code to each page. It would be useful to be able to embed system data (specifically the date, though there may be a few other possible items, for example an email address) into the HTML, such that it is automatically updated as each page is created.
ID:5535
Adding a date to web pages
Posted: 31 Oct 2011 14:07
by tatewise
Not quite sure exactly what you want, but you can do what you request already.
You just have to know a smattering of HTML.
Try adding the following to the
in the section, below the menu bar.
Code: Select all
<p style='margin-left:20px'>Date: <b>31 October 2011</b></p>
<p style='margin-left:20px'>E-mail: <a href='mailto:post@domain.com?Subject=FH Web Page'>post@domain.com</a></p>
It should produce something like:
Date:
31 October 2011
E-mail:
post@domain.com
This example uses the ... paragraph tags.
The
style='margin-left:20px' style indents by 20 pixels from margin.
The ... tags embolden text.
The ... E-mail anchor gives the E-mail link.
Adding a date to web pages
Posted: 31 Oct 2011 16:00
by RogerF
Thanks, Mike, but you missed the key phrase -- 'automatically updated'. What I'm hoping for is along the lines of:
Date: $DATE
Adding a date to web pages
Posted: 31 Oct 2011 17:17
by johnmorrisoniom
To add an automaticaaly updated date, cut and paste the following
Last Modified : 01-Apr-2010 16:42
The date, although showing 1st april at the moment, will update every time you save.
The part [Last Modified : ] is optional, it's just the way I use it. You can put in any text you like
Adding a date to web pages
Posted: 31 Oct 2011 17:50
by Jane
John, I think that's a dream weaver extension, so will probably only work with dream weaver.
http://www.webdeveloper.com/forum/archi ... 37347.html
Adding a date to web pages
Posted: 31 Oct 2011 17:57
by RogerF
That's a nifty idea, John -- I've not come across the #BeginDate syntax before -- but unfortunately it doesn't work. The date displayed at the foot of each generated page stays implacably fixed at 01-Apr-2010 (using Firefox 7).
Adding a date to web pages
Posted: 31 Oct 2011 21:13
by tatewise
Using some
JavaScript to display the
File Modified Date should work.
Code: Select all
<p style='margin-left:20px'>
<script type='text/Javascrypt' language='Javascrypt'>
<!--
// format date as dd-mmm-yy example: 12-Jan-99
function date_ddmmmyy(date)
{
var d = date.getDate();
var m = date.getMonth() + 1;
var y = date.getYear();
// handle different year values returned
if(y >= 2000) { y -= 2000 }
if(y >= 100) { y -= 100 }
// could use splitString() here but following is more compatible
var mmm = (1==m)?'Jan':(2==m)?'Feb':(3==m)?'Mar':(4==m)?'Apr':(5==m)?'May':(6==m)?'Jun':(7==m)?'Jul':(8==m)?'Aug':(9==m)?'Sep':(10==m)?'Oct':(11==m)?'Nov':'Dec';
return '' + (d<10?'0'+d:d) + '-' + mmm + '-' + (y<10?'0'+y:y);
}
// get last modified date of the current document.
function date_lastmodified()
{
var lmd = document.lastModified;
var s = 'Unknown';
var d1;
// check if we have a valid date before proceeding
if(0 != (d1=Date.parse(lmd)))
{ s = '' + date_ddmmmyy(new Date(d1)) }
return s;
}
// finally display the last modified date as DD-MMM-YY
document.write( 'This page was created on ' + date_lastmodified() );
// -->
</scrypt>
</p>
If you put the three JavaScript functions in a separate
date.js file then only the
document.write(...) is needed in the section.
The section would include:
Code: Select all
<scrypt type='text/javascrypt' src='date.js'></scrypt>
Adding a date to web pages
Posted: 01 Nov 2011 06:26
by RogerF
Thanks, Mike; that certainly works. But it would still be better if it could be neatly packaged within FH.
Adding a date to web pages
Posted: 25 Jul 2012 22:13
by Cambiz