Skip to main content

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...)

Comments

Popular posts from this blog

Custom Export to CSV

It's been a while since I've updated my blog. I've been quite busy lately, and just have not had the time that I used to. We're expecting our 1st child in just a few short weeks now, so most of my free time has been spent learning Lamaze breathing, making the weekly run to Babies R Us, and relocating my office from the larger room upstairs to the smaller one downstairs - which I do happen to like MUCH more than I had anticipated. I have everything I need within a short walk - a bathroom, beer fridge, and 52" HD TV. I only need to go upstairs to eat and sleep now, but alas, this will all change soon... Recently, I was asked if you could change the way Export to CSV in ApEx works. The short answer is, of course, no. But it's not too difficult to "roll your own" CSV export procedure. Why would you want to do this? Well, the customer's requirement was to manipulate some data when the Export link was clicked, and then export it to CSV in a forma...

Manipulating Images with the... Database?

A recent thread on the OTN HTML DB Forum asked about how to determine the width & height of an image stored as a BLOB in an Oracle table. I mentioned in that thread that I have some code to manipulate an image stored in a BLOB column. This is particularly useful if you’re going to let users upload images, and you want to re-size them to display as a thumbnail. Thanks to Oracle interMedia , it is trivial to manipulate the width, height, and other attributes of images stored in an Oracle table. I’ve created a sample application here which demonstrates Oracle interMedia and HTML DB in action. Feel free to have a look. You can download this application from HTML DB Studio as well. Basically, this application allows you to upload images and perform an operation on the image as it is inserted into the PHOTO_CATALOG table. There are two places where some PL/SQL code is required: an After Submit process on page 2, and a procedure to display the images. Here is the PL/SQL for the After...

Refreshing PL/SQL Regions in APEX

If you've been using APEX long enough, you've probably used a PL/SQL Region to render some sort of HTML that the APEX built-in components simply can't handle. Perhaps a complex chart or region that has a lot of custom content and/or layout. While best practices may be to use an APEX component, or if not, build a plugin, we all know that sometimes reality doesn't give us that kind of time or flexibility. While the PL/SQL Region is quite powerful, it still lacks a key feature: the ability to be refreshed by a Dynamic Action. This is true even in APEX 5. Fortunately, there's a simple workaround that only requires a small change to your code: change your procedure to a function and call it from a Classic Report region. In changing your procedure to a function, you'll likely only need to make one type of change: converting and htp.prn calls to instead populate and return a variable at the end of the function. Most, if not all of the rest of the code can rem...