Tuesday, April 22, 2008

Cloning your Corporate UI with HTML DB - Part III (Re-Post)

The following is a re-post of the "Cloning your Corporate UI with HTML DB" series that I blogged about back in 2005 on the now-defunct Orablogs site. Most of the content and advise is still the same today, and has been reposted here exactly as it was on the old site.

June 10, 2005
Before I jump into the Page Header & Footer, I thought that I'd take a minute to detail how moved all of the images from www.oracle.com to htmldb.oracle.com. Using Firefox, I'm able to view a list of all images on a page by right-clicking the page and selecting View Page Info. Under the Media tab is a list of all images referenced on this page. I decided to use http://www.oracle.com/technology/products/database/oracle10g/index.html as a starting point. All in all, there were about 15 images which I saved, and then moved to htmldb.oracle.com.

I FTP'ed all of these images to a new directory on htmldb.oracle.com, in order to keep them all organized in a single place. Next, I have to change the image paths & BASE_HREF in the Page Template. Currently, the BASE_HREF is still set to http://www.oracle.com/technology/index.htm . Changing it to http://htmldb.oracle.com/i/ocom/ dramatically improved the way that most of the page rendered. However, as you can see below, the tabs & DHTML menus are based on a not-yet-copied-over CSS:

So as you may have guessed, it's time to copy over the CSS files from OTN. Since I have some custom CSS entries, I decided to create a 3rd CSS file - ocom.css - which I will use for my own CSS entries. This way, I can be assured that the OTN-supplied CSS files are always in-tact.

BASE_HREF issues
I just noticed something bad: all of the HTML DB-generated links (menus, lists, items, etc.) are picking up the BASE_HREF syntax, and appending that to the beginning of the URL, thus rendering them useless! I guess removing the BASE_HREF line altogether is my best bet. Doing so has fixed the link issues, but I'll have to keep an eye out to see if anything else is still broken.

Broken Images
Next, I took a pass at fixing all of the broken image tags on the page. Fortunately, this task is made easier with the Web Developer extension. Selecting "Find Broken Images" from the Images menu yielded a nice list of what I need to fix. Thus, a simple Search & Replace in Dreamweaver fixed all of my Broken Image woes.

Not only does it look good, it actually works:

Header & Footer
Let's start with the Footer, since it's the easier of the two. It looks like the footer did not change at all from one OTN look to the next. Thus, I don't have to do a thing! Woo hoo!!!

The header is a different story. Let's start with the tabs. Looking at the HTML source of the Page Template in Dreamweaver, it's pretty easy to identify the HTML for the tabs:

<div id="bannerMid"><a href="/index.html" class="headlink">ORACLE.COM</a> <span class="loclink">TECHNOLOGY NETWORK</span> <a href="/partners/index.html" class="headlink">PARTNERS</a> <a href="http://oraclestore.oracle.com" class="headlink">STORE</a> <a href="http://metalink.oracle.com" class="headlink">SUPPORT</a></div>

Looks like the OTN folks did a nice job with these, as it's as simple as it can get. For a non-current tab, the HTML is nothing more than an "A HREF" tag with a class. A current or selected tab has a SPAN tag surrounding it. In an HTML DB Page Template, we can use the token #TAB_CELLS# to represent where we want the tabs to be dynamically rendered. A simple edit to the above HTML is all that is needed, so that it now look like this:

<div id="bannerMid">#TAB_CELLS#</div>

When HTML DB sees the #TAB_CELLS# token, it will refer to the Standard Tab Attributes portion of the Page Template. HTML DB will then render a tab - be it current or non-current - for each tab which is defined in the Application. All we have left to do is provide some HTML for Current and Non-Current tabs. Based on a combination of the static HTML used for tabs on OTN and some more HTML DB tokens, we can easily construct the HTML for both types of tabs.

Current Tab HTML: <a href="#TAB_LINK#" class="loclink">#TAB_LABEL#</a>

Non-Current Tab HTML: <a href="#TAB_LINK#" class="headlink">#TAB_LABEL#</a>

I modified the HTML slightly for the current tab to include a link. OTN doesn't use one, but when a user is in HTML DB Studio and wants to jump to the "Technology Center" home page, I'd like that to work. Moving the CLASS inside the A HREF tag ensures that the text of the tab will be rendered the same way that the OTN ones do - in red.

As a last step, we have to change some of the Tab names in the HTML DB Studio application, as those have changed. We'll also have to make the TECHNOLOGY NETWORK current for all of the pages in HTML DB Studio. With the previous look, both Current and Non-Current tabs looked identical, so there was no reason to make them look different.

All looks good, but the tabs - when clicked - are throwing up 404 Errors.

50 points if you can tell me why! (I'll address it in my next entry...)

No comments: