You have a standard stylesheet or some great JavaScripts that you use all the time on Notes Web application, and you want to use it for all your databases. Also, everytime you update these stylesheets or JavaScripts, you want the changes to propagate to the rest of the database.
For example, if we have a stylesheet called 'test.css' and a javascript code called 'jtest.css'.
(1) Create a new database template, let's call it 'StdDB' and create a subform and create attachment for 'test.css' stylesheet and the 'jtest.js' that you have just created, let's call it 'StdElement'.
(2) Create two shared fields, one for the stylesheet and another for the javascript, 'StdStyle' and 'StdJava' respectively.
(3) To reuse these element on your new database, copy the subform and the shared field(s) into the new database. Check the design properties and make sure it inherit the design from the template.
(4) To use these element, insert the shared field(s) at the top of a form. You could now call the functions of the attached javascript file and all tags with class declared in the stylesheet would follow.
(5) Should you need to updated these files, just go to the 'StdDB' template and do the changes. Databases could then refresh their design and all the standard files attached in the subform 'StdElement' would be refreshed too.
Code for 'StdStyle' shared field:
path:=@ReplaceSubstring(@ReplaceSubstring(@Subset(@DbName;-1);"";"/");"
Requires Free Membership to View
Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.
"<link rel="stylesheet" href="/" + path + "/<subform_name>/$File/<file_name>?OpenElement">"
Code for 'StdJava' shared field:
path:=@ReplaceSubstring(@ReplaceSubstring(@Subset(@DbName;-1);"";"/");" ";"%20");
"<SCRIPT LANGUAGE="Javascript" SRC="/" + path + "/<subform_name>/$FILE/<file_name>?OpenElement"></SCRIPT>"
This was first published in March 2001