* Adding a date to web pages

Requests that have been moved to the Wish List, or deemed to need no further action
Post Reply
User avatar
RogerF
Famous
Posts: 182
Joined: 26 Apr 2009 16:32
Family Historian: V6.2
Location: Oxfordshire, England
Contact:

Adding a date to web pages

Post by RogerF » 31 Oct 2011 12:32

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
Roger Firth, using FH to research the FIRTHs of Lancashire and Yorkshire, and the residents of the market town where I live.

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Adding a date to web pages

Post by tatewise » 31 Oct 2011 14:07

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.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
RogerF
Famous
Posts: 182
Joined: 26 Apr 2009 16:32
Family Historian: V6.2
Location: Oxfordshire, England
Contact:

Adding a date to web pages

Post by RogerF » 31 Oct 2011 16:00

Thanks, Mike, but you missed the key phrase -- 'automatically updated'. What I'm hoping for is along the lines of:

Date: $DATE
Roger Firth, using FH to research the FIRTHs of Lancashire and Yorkshire, and the residents of the market town where I live.

User avatar
johnmorrisoniom
Megastar
Posts: 882
Joined: 18 Dec 2008 07:40
Family Historian: V7
Location: Isle of Man

Adding a date to web pages

Post by johnmorrisoniom » 31 Oct 2011 17:17

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

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Adding a date to web pages

Post by Jane » 31 Oct 2011 17:50

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
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
RogerF
Famous
Posts: 182
Joined: 26 Apr 2009 16:32
Family Historian: V6.2
Location: Oxfordshire, England
Contact:

Adding a date to web pages

Post by RogerF » 31 Oct 2011 17:57

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).
Roger Firth, using FH to research the FIRTHs of Lancashire and Yorkshire, and the residents of the market town where I live.

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Adding a date to web pages

Post by tatewise » 31 Oct 2011 21:13

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>
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
RogerF
Famous
Posts: 182
Joined: 26 Apr 2009 16:32
Family Historian: V6.2
Location: Oxfordshire, England
Contact:

Adding a date to web pages

Post by RogerF » 01 Nov 2011 06:26

Thanks, Mike; that certainly works. But it would still be better if it could be neatly packaged within FH.
Roger Firth, using FH to research the FIRTHs of Lancashire and Yorkshire, and the residents of the market town where I live.

avatar
Cambiz
Famous
Posts: 235
Joined: 26 Sep 2003 23:30
Family Historian: None

Adding a date to web pages

Post by Cambiz » 25 Jul 2012 22:13

WL#499 has been raised

Please vote for it here:

http://www.fhug.org.uk/wishlist/wldispl ... lwlref=499

Post Reply