Add a 'Last Updated' Value in the Web Pages Template

If you ever used the Web pages template to create your homepage, and if you happen to use the 'create page with HTML' form, you will now how frustrating it is that you can not use many of the functionalities which you could benefit if you use a normal Notes form to create the page. I wanted to put a counter and 'last updated' line to my Web page, but I found out that its not easy and reached quite a good workaround. I will show you how I added a 'last updated' line, and the counter can be done in a similar fashion. Follow the steps below:

Add a field in the 'Web Page Using HTML' form called lets say 'LMod', make it of type editable with a default value of '@now'. Now open your Web page that was created earlier with that form and re-save your doc for the field to take effect.

In the form's query save event, add this line to the end of the code which is already there, 'Call source.fieldsettext("LMod",Str(Now))'

Then create the following shared agent with the property 'run as web user' checked in the agent properties dialog.

In the view 'All Pages' cut the first column (which is made of of 1 and 2 values) and paste it after the column 'Page Title/Name' column. As an optional work, you can add a new column in the 'All Pages' view called 'Last Modified' with the value of 'LMod'.

Create a shared agent with the following attributes:

When? Manually from Actions Menu.
Which? Run Once.

Lotus Script:

Sub Initialize
Dim s As New notessession
Dim db As notesdatabase
Dim v As notesview
Dim doc As notesdocument
Dim doc_v As notesdocument
Dim cgiqs As String
Dim text As String

Set doc = s.documentcontext
Set db = s.currentdatabase
Set v = db.getview("All Pages")
cgiqs = doc.Query_String(0)

If Instr(Lcase(cgiqs) , "&pagename=" ) > 0 Then
text = Mid ( cgiqs , Instr ( cgiqs , "&pagename=" ) + Len (
"&pagename=" ) )
If Instr ( text , "&" ) > 0 Then
text = Left ( text , Instr ( text , "&" ) -1 )
End If
End If

Set doc_v = v.getdocumentbykey(text)
text_d = doc_v.getitemvalue("LMod")
Print "Content-Type:text/plain"
Print "Content-Type:text/html"
Print "&LTHTML>"
Print "&LTbody BGCOLOR='#FFFFFF' text='#000000'>"
Print"&LTh5>&LTstrong>&LTp align='center'>Last Updated: (" + text_d(0) +
End Sub

Finally, Add this in your HTML Page:

<!-- For IE-->
&LTCENTER>&LTIFRAME align="center" width="350" height="40"
frameborder=0 noresize scrolling=no></IFRAME></CENTER>

<!-- For Communicator-->

If you want more control you have to use JS and choose based on the user's browser. You can add both tags it will work fine though, but if there are text/tags in between they will not be ignored by the corresponding browser.

This was first published in November 2000

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.