Tips Week 2.4 - Tab Highlighting in CSS
One of the tips I had jotted down was a bit of a joke really. Along the lines of "don't eat yellow snow". This was a lesson I learnt the hard way some time ago — If your only access to a server console is via webadmin and you need to restart the web server, make sure you use "tell http restart" and not "tell http q". There's no way to follow this up with "tell http load" when http ain't there!
Anyway, a real tip for you. Something I learnt recently while working with clearleft was a way to highlight the current tab using nothing but CSS. On this site, right now, either the Home or the Blogs tab is highlighted, depending which way you came to the site.
This highlighting uses a CFD field, called "currTab", on every form to store the name of the tab that should be highlighted. In the "navigator" subform each tab has a Computed Value area that refers to this field. In the Articles tab (inside the <li> tag)is a computed area of:
@If(currTab="Articles"; "class=\"on\""; "")
This works but it relies on computed fields and six computed values. You can do away with this computation by using nothing but CSS.
In each form add the name of the tab to highlight as a class name to the Body tag, so you get this:
<body class="blogs">
In the each tab in the navigation subform give each element an ID that follows the naming convention, like so:
<li id="tab-blogs"><a href="blogs?OpenView"...
Then, in your CSS add:
body.blogs #tab-blogs, body.articles #tab-articles{ /* etc */ background-color: #fff; }
Et voila, no computing and no fields. Makes sense?
A nice addition to this method is using computed fields in your css file (if you use a Domino page to hold it).
Simply do a lookup to find out which 'areas' your site has, and use computed text to write out your css selectors. Then you won't have to edit your css if you add a new tab.
As we approach the end of the 'Tips' series... What about a Domino based 'Site of the Day' series all next week based around sites that use domino (in some form or other)?... a bit like the Macromedia Hall of Fame.
ehm... maybe "tell http q" cannot be followed with "tell http load", but you surely could use "tell http q" and follow up with "load http" in the server console via webadmin, or am I missing something here?
Btw great tips!
@ Tom
I think the working assumption is that WebAdmin runs on the http task, so if the task is stopped, your request back to the server from the webadmin client to "load http" will not be heard.
Nice tip, Jake. I like Adams suggestion too, makes it a bit more portable.
@Jerry
thanx your totally right, should have read better
@jake:
have you heard ever about a small
"DOMINO LITE "subset version of domino 7 ?
makerjoe. no.
Also sometimes you need to do the "tell http q"/"load http" shuffle because a "tell http restart" doesn't always do the same thing - an example is changing SSL/HTTPS settings.
How about restart task http
Been away 4 a few days hence the late response, but if u knocked out http you could always use @Command( [AdminRemoteConsole] ) - (on a smarticon maybe) to get to the console?
Glad you picked up on the CSS-for-tabs stuff we've been doing. We're all for moving any presentation logic we can into the style sheet - it's where it belongs afterall.
Sometimes this makes the style sheets quite weighty (still small compared to your average image), but browsers only load them once and I think most would agree it's better to make the browser work a little harder than burdening the server with extra work. Up to a point anyway.