What is the Golden Rule?
URLs (Universal Resource Locator) such as http://www.notesninjas.com or http://www.adfos.com should not be hardcoded into agents, action buttons etc
Use computed text or use formulas like
DBName := @Implode(@Explode(@Subset(@DbName;-1);"\\");"/");
or (this newer version does not confuse the @function text formatting colour coding parser)
DBName := @Implode(@Explode(@Subset(@DbName;-1); @char(92));"/");
and then
@URLOpen("/" + DBName+"/Agent1?Open&var=all" );
In lotusscript try using:
print "<img alt=' On Leave' src="int/leave/$File/leave.gif"">"
or use Script_Name or Path_Info from the document context.
Alternative for Release 6 onwards
Use @webdbname
eg in computed text: marked as pass-thru html:
"<a href='/"+@WebDbName+"?opendatabase&login'>"+@DbTitle+"</a>"
Another way of opening Database in the browser from Notes which tries to grab the web hostname:
srvr:=@Subset(@DbName;1);
r:=@If(@ClientType="Web";
@GetHTTPHeader("Host");
@DbLookup("";srvr:"names.nsf";"($Servers)";@Subset(@DbName;1);"HTTP_HostName"));
s:=@If(@IsError(r) | @Text(r)="";
@DbLookup("";srvr:"names.nsf";"($Servers)";@Subset(@DbName;1);"SMTPFullHostDomain");
r);
"<a href='"+"http://"+@Text(s)+"/"+@WebDbName+"/formorAgent' target='_blank'>here</a>"
Why follow this Golden Rule?
If you move the database or your company gets a new domain name or your company merges you will be in trouble.
If you need a new instance or copy of the database then this will make life easier.
If you like to have a development copy of the database for bug fixing or problem solving this will make your life easier.
If the server goes down and you need to move the database to another server temporarily this make your life easier.
Exceptions
I have not seen a valid reason not to do this.
How do I fix this problem?
Search for "http" or "HTTP" or ".com" or whatever the URL that is failing uses.