Reuse Standard Stylesheet or JavaScript in All Databases

Reuse Standard Stylesheet or JavaScript in All Databases

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.

    By submitting your registration information to SearchDomino.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchDomino.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

";"%20");
"<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

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.