dominoGuru.com
Your Development & Design Resource
CGI Variables in a CSS Document
04/14/2003 02:10 PM by Chris Toohey
I responded to a posting in LDD regarding CGI
Variables in a CSS
document.
This article describes how I was able to make a "real" CSS from a Form element
containing CGI Variable fields.
Error 500
HTTP Web Server: Application Exception - Documents treated as HTML cannot
be edited
If I wanted to put, say Remote_Addr (a CGI variable which, when computed to itself, will provide a user's IP address) into a such a form, I would need to either create the field with HTML ("ok" way of getting around it I suppose - but not what I had in mind) which may still not work or find a way to *fool* Domino server into thinking that it wasn't really serving up a form.
... then I thought of it!
First thing's first, I need to give credit to the site who sorta "inspired" this solution. If I could do this for a home page (like I've done here), why can't I do this for a form that's going to act like a CSS document?!?
So I created a completely blank navigator called "name.css". Then I created
a form called "$$NavigatorTemplate for name.css", which I set to "Treat
contents as HTML" and included a computed for display hidden field called
"Remote_Addr" (computed to itself).
Next, I basically started building the CSS:
A:LINK, A:ACTIVE, A:VISITED {
color: BLACK;
text-decoration: NONE;
}
A:HOVER {
color: #8B0000;
text-decoration : underline;
}
.hWork{
}
... and now for that computed text...
workList := "127.0.0.1";
@If(
@IsMember( Remote_Addr ; worklist );
"display: none;";
"")
... And there you have it!.
Now, I used the CSS sheet named name.css like I would normally use a CSS
sheet in Domino: Add a field called $$HTMLHead or add to the HTML Head Content
section the following code -
version := "main";
"<link rel=\"stylesheet\" type=\"text/css\" href=\"/"+ db +"/"+ version +".css\">"
Now this opened the name.css (which is a blank navigator) using the
$$NavigatorTemplate for name.css (which actually contains the CSS and the CGI
variable) as a mask - returning:
A:LINK, A:ACTIVE, A:VISITED { color: BLACK; text-decoration: NONE; }
A:HOVER { color: #8B0000; text-decoration : underline; } TR { color:BLUE;
font-family: "MS-Sans Serif"; font-size: 8pt; } .hWork{display:
none;}
(hey, I tested this on my local machine...)
With this, I can now "hide" sections of my application based on reffering URLs, user IP addresses, and all other CGI Variable triggers! By using a blank navigator and a $$NavigatorTemplate, I was able to *hack* a fix as well as open up a world of possibilities!!!