Main Points

This page begins testing for May 4, 2009. It's now 2009/10/27, and boy, who would've thought all this would happen. I just launched the new "Medieval Scroll" design for Earth Chronicle. Obviously, I've kept a lot of the basic design and color scheme for the Beta site, though I would like to do a formal design on it as well. You can see here that the underlying XHTML and the layout CSS have been upgraded using the techniques we learned while building from the "Medieval Scroll" design. Throughout the new design's development, I was working diligently, and muddling my way through to create reusable and maintainable components with object oriented CSS (OO-CSS). At times, I was highly skeptical about just how effectively I was implementing it. I knew the principle was sound, but my ability to execute it, especially at first was sadly lacking. As the design progressed, I got busier and was paying attention to implementing it, not whether I was doing a good job or not. It was a learning process and I just gave myself permission to screw it up; it was a necessary phase of building it. Now that everything is finished and tweaked at this point, it's turned out far better than I would have ever imagined.

There were certainly things I modified as I incorporated changes from "Medieval Scroll", especially collecting design styles together so that the color schemes and borders are easy to modify. What surprised me is that this was not in any way contrary to OO-CSS. Those design statements are related to the color scheme... that Is their semantic meaning. Pulling the color and background statements out actually improved the object oriented nature of the stylesheet, because the components can now be dropped into any site with any color scheme. Also, I offer this as evidence of my success... it took a couple months to pull together the complete design for "Medieval Scroll". This morning, I started modifying the CSS for the Beta site. It only took me one - admittedly very full - day to incorporate the components I wanted into the new site including the new IE6 stylesheet, the new semantic .NET control names, everything. I'll need to test over the next day or two and update all the core pages; we have made changes to the content page format and those changes will have to be updated in every file. :P Yuck. However, overall I'm very pleased.

Yesterday, I rewrote the XHTML for the master pages. The primary master page serves all the sites, so I needed to update it to accommodate the new design for Earth Chronicle without killing the beta website. Some of these changes made the main master page more generic to work for both websites. Some changes like the forward and back links were made because the new design helped iron out some of their functionality which I incorporated into the beta design. Naturally these cascaded, though fortunately most changes were confined to the beta nested master page as intended; for instance, the #mainPointsBoxout has been moved entirely into the nested master. This gives me the possibility of creating pages with alternative inpage navigation. My content review section has a page from 2005 in it because I couldn't manage this before. Now for the first time, I can think about getting it out. So welcome to the new design, and let's take a look at the new changes.

Big Changes

Major XHTML Layout Rewrites

I moved the form tags that wrapped the entire page to specifically wrap the contact form. A friend of mine who codes beautifully, recommended this to me. So I'm going to give it a try. The tag is still in the master pages so it's easy to go back if I need to, but so far it works fine. In the month between when we finished the demo and initially developed this revision, we've been detoured getting a start on some serious C# programming. In fact, there are a number of things you can do outside the form tags using simple code render blocks or HTML controls that include runat="server" attributes. However, we finally uncovered some heavier programming areas where this does in fact collapse. Therefore, it's fortunate that the form elements were so easy to change because we needed to put them back. ASP.NET requires form tags be wrapped around some functionality we were trying to deploy, and while it will allow you to use more than one form element, but it only allows one form element with runat="server". Therefore, it's better practice to simply wrap the entire page in a form tag. Mine is nested just inside the <body> tag so it grabs everything. [chroniclemaster1, 2009/10/27] The page is also wrapped by the #outerContainer and #innerContainer divs, nested just inside the <form> tags. This is critical structure for the new Earth Chronicle layout, and I've incorporated some of the style rules for these divs into the Beta design. Most notably, using OO-CSS, I've added the style rules for padding on the #innerContainer div to create whitespace around the edge of the page.

Perhaps the most innovative change is the addition of several Shea extraDivs, empty div elements containing a nested span; extraDivs are used for applying additional background images to a design. Four Shea extraDivs sit at the very end of the #innerContainer tag. Another pair have been nested inside the main points div, though I'm not yet using any of them in the Beta layout. However, all four #innerContainer extraDivs are critical components in the Earth Chronicle design and had to be incorporated in the master pages. Looking ahead to the future, I expect to use these in the new Beta design, so the four Shea extraDivs at the bottom of the page are in the primary master page for all the sites.

The mess of divs in the footer have been reduced to a footer and it's wrapper; the cleaning was extremely thorough and dramatically improved the XHTML's semantics. The authorship section is renamed credits; the new #credits and the old #postingDates sections are each turned into a list. Each list item takes a unique class so I can target styling by credit or date. This is exactly what I've used to add alternating stripes as if this were a table design; I was very pleased with how well that worked out. Each list item contains an h4 element (for the title) and cite element (for the name / date). These more appropriate tags replaced a multitude of divs, each of which required special classes, because the div elements were not semantically specific of the purpose of the elements. These changes have made the #credits and #postingDates infinitely more readable in code, stripped out approximately half the previous markup, while giving similar if not improved flexibility.

The navigation is wrapped in new a pair of divs, #nav and #navWrapper, and the first element inside is a new skip link provided to satisfy guideline letter O of the section 508 accessibility guidelines. The three nav elements have been normalized. I've always thought this was taken care of, and yet I keep running across odd ways in which they're inconsistent. No more because I've upgraded each of the main nav elements and they're semantically consistent: the accessible page links and the top navbar (which have the same links), and the Earth Chronicle navbar at the bottom. Each is an unordered list in a wrapper div. Each list item has a nested list for the menu (in the accessible page links, the nested lists are the rows). The navbars are now driven by CSS only, so there is a conditional comment to call an IE6 javascript file. I wouldn't have written a script to drive the menus expressly for IE6. But since I already have one, I see no reason not to provide that important functionality to the many IE6 users. If you're not familiar with conditional comments, here's the second one I've included to pull in a special IE6 stylesheet.

<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" media="all" title="ecIeFixes" href="<%= ResolveClientUrl("../../CSS/2009/ecBetaIeFixesTesting.css") %>" />
<![endif]-->

A fundamental change in the design is how we approach CSS. Previously, I'd tested against IE6 first and then other browsers, working back and forth to find cross-browser compatible solutions by trial and error. IE7 and IE8 are sufficiently advanced in most areas that I was able to build a fully modern CSS2.1 design using cutting edge techniques in a completely standards compliant stylesheet. So this was my primary method of writing CSS unburdened from IE6. Then I incorporated a separate stylesheet for IE6 using Microsoft's preferred conditional comments to include it; it literally reads if "l"ess "t"han or "e"qual to IE 6, then include this XHTML. This means the main stylesheet is engineered more efficiently using all best practices and the very latest CSS techniques. Then the separate IE6 stylesheet is my shield against that browsers failings. This results in a more stable primary stylesheet and one that's much more powerful than anything I've ever done before. It's also more forward compatible in the sense that the IE6 stylesheet can be tossed when the browser is no longer important to support, and the main stylesheet will require no updating when that happens. Also note that the href attribute contains my new secret weapon. :)

The ResolveClientUrl() Method

This is the first inline expression - a block of code contained in an XHTML page between <%= ... %> characters - I've used in Earth Chronicle. Using the ResolveClientUrl() method, I've been able to incorporate the CSS <link> tags into a contentplaceholder tag inside the head element of the nested master page. This is huge! When you use .NET tilde notation for application root relative references for the link elements, they won't respond to the runat="server" attribute. I had gotten around this by placing runat="server" in the <head> tag. Once you wrap a contentplaceholder around the link elements, however, they're effectively isolated; ASP.NET can't process the paths via the runat="server" attribute in the head tag. This is unfortunate because wrapping the links in a contentplaceholder allows you to use these default CSS calls on every page simply by doing nothing. And if a page needs custom CSS, you simply insert a content element which corresponds to the contentplaceholder; the default <link> tags are thrown out and only what you specify in the content page will be used. The result is that I could not apply custom stylesheets to individual pages, when it seems like it "ought" to be simple to override the default stylesheet calls.

I've lived with this, but it seriously annoyed me. I put out numerous queries about this behavior on several expert boards every since I was first testing master pages, and I get a bee in my bonnet over it every few months and hit the boards again. Each time I got ideas but nothing that worked. When I was preparing for the "Medieval Scroll" demo, I really needed to insert custom CSS for the demo. In practice, I think it turned out to be a good thing, it made me build custom master pages for the design demo; that allowed much more flexibility and gave me the chance to experiment with the XHTML as well as the CSS, something I could not have done otherwise. Nevertheless, I heard back from someone at p2p.wrox.com about two days after I'd rebuilt the master pages for the design demo. They suggested yet another technique, but one I hadn't heard of before, a method called ResolveClientUrl(). Being up to my eyeballs in the design demo, I filed the idea away for future reference. Now that the demo is complete, I was incorporating a lot of the work I'd done back into the Beta website, I found that I had inadvertently tried to incorporate the links into the page inside a contentplaceholder. You'll understand why this was good design, but I'd forgotten the problem; predictably, my new pages could not locate the stylesheets. I considered just undoing everything, but remembering the post I'd set aside, I went back to research this technique. By calling this method inside an inline expression, I'm now able to perfectly incorporate CSS files in my master pages while allowing individual pages to override those calls if necessary. :D I also intend to work up a page about ResolveClientUrl() to better understand how it works.

However, I've already put it to a couple other uses. When using forward slash(/) application root relative references on my dev box, .NET demands that they begin /webroot/ECBeta/..., while my production server disagrees and demands /ECBeta/... causing problems anytime I shuffle files back and forth. Obviously, I use this technique as little as possible, but there are four places I use them. CSS and javascript files aren't processed by .NET; you can build them on the fly and do processing that way, but mine are not that sophisticated yet. I've sequestered those calls into one CSS file per website which I do have to change. The javascripts add optional functions, so I've built them using /ECBeta/... references that work fine on the server, but I have to add the /webroot reference to check it on the dev box which I rarely do; usually only during testing or when I first move it to the server.

The third location is the calls to add external javascripts in the primary master page. The <script> tag can't accept a runat="server" attribute because ASP.NET then believes it's a server side script. Therefore, I was having to remember to swap /webroot references whenever I swapped files between the dev box and production server. ResolveClientUrl() worked beautifully to remove this headache. The fourth and final location was a pair of src attributes in the user control for the Flash logo. As optional functionality, I'd set these to work on the production server, but I can't see them on my dev box (also IE never stops trying to load the bad file so it's always been annoying opening pages with Flash pages on my dev box with IE. By using ResolveClientUrl() to specify the paths to the .swf file, I can now call the Flash logo from the production server or my dev box using the same reference which no longer requires changes. So now only the CSS files still use /webroot references that I have to remove when I upload files.

Minor Changes

These changes are not of the same major scope as the other already outlined. However, the devil is in the details.

  • The form elements have been given much more semantic names in code. Fortunately, this results in much more professional programming. Unfortunately, this results in three elements with XHTML ids such as #ctl00_ctl00_placeholderForContactForm_component_ContactForm_questionsAndCommentsTextarea. I do wish .NET were a little more intelligent than this, such horrific XHTML ids may permit huge development teams to function more safely, but surely there has to be a middle ground. Regardless, I'm not sacrificing important form functionality that visitors can use, or throwing out the master pages and user controls that make my site reasonably maintainable for the first time. Certainly not when the pay off is only shorter CSS style rules (there are only about a dozen styles using these IDs), a slight increase in code readability, and shaving a couple hundred bytes off the page downloads.
  • I've also modified my coding practice to consistently put the runat="server" attributes first in the element tags. This makes server active controls easier to identify and is also easier to deal with in my XHTML editor.
  • I swapped the clock and h1 heading; while I intend to completely revamp the Beta design, for now it is what it is. During testing of the new collapsible navbar in the Earth Chronicle design, I discovered that putting the clock above the heading keeps the heading visible regardless of the browser width / font size / zoom, etc. While the new site ID logo and the header image gallery replaced it in the "Medieval Scroll" design, there's no reason not to use it here in the Beta site.
  • The page forward and back links are now positioned immediately before and after the #mainBody div that wraps the content. They are full sibling divs nested directly inside #innerContainer.
  • The h2 id, #mainPoints, was changed to the more descriptive #mainPointsTitle. All the Main Points skip links have been updated to this name. The example skip link at the bottom of Main Points boxout was dropped to shorten the boxout in case XHTML elements hang on the bottom of it. It wasn't really necessary anyway.

Level three heading

I've also modified the headings, so here's a complete look at all the various standard options. Most significantly, the headings are uniformly set in Arial, with the exception of the page title in Georgia.

Level four heading

A paragraph for kicks. A paragraph for kicks. A paragraph for kicks. A paragraph for kicks. A paragraph for kicks. A paragraph for kicks. A paragraph for kicks. A paragraph for kicks. A paragraph for kicks.

Level five heading

A paragraph for kicks. A paragraph for kicks. A paragraph for kicks. A paragraph for kicks. A paragraph for kicks. A paragraph for kicks. A paragraph for kicks. A paragraph for kicks. A paragraph for kicks.

Level six heading

There are also a number of markup structures that are now available because of our OO-CSS work. Some were created specially for the design demo process, though as much as possible I tried to make them as universally applicable and robust as possible. If you'd like to see a current list of the markup structures, how they're created and what they do, check them out!

Content Page Changes

However, there have been some changes to this content page as well. For obvious reasons, I've kept these to a minimum, because every core page will need to be modified with every change. Being able to absorb most of the change in the master pages is a god send.

The introduction and conclusion divs now are wrapped in their own set of container divs. (e.g. #intro, #introWrapper, #introSpacer) While there are few conclusion paragraphs, incorporating the intro markup will be one of the most delicate changes to the core pages. The h1 heading is now the target of the navigation skip link, so the id="pageTitle" has been added to every <h1> tag as well as the tabindex to correct the IE keyboard navigation flaw. That is a relatively minor change, but again, not a pleasant one. The slightly modified format of the page forward and back links has been updated. The <sup></sup> tags around the "Skip to Main Points" link have been replaced with the <div class="skipLink"></div> tags.

Semantic ASP.NET variable names

Most of the requisite changes to the content page are semantic issues with the .NET variables, specifically names of content and contentplaceholder controls. These are relatively simple changes, but will take a lot of time simply because there are so many to change. Based on my previous training, I had followed along with naming practices like btnSend for buttons that send email and oMail for email objects; these are the typical names you see in some college classes and most ASP.NET books. This has always confused and bothered me, but "everyone" does it this way and I was so new to programming that I deferred to my teachers. However, as I'm becoming more adept at programming, I got my hands on a copy of Steve McConnell's Code Complete 2. McConnell is a heavy in the Microsoft community, the book is even published by Microsoft Press, yet he's worked with many technologies and languages and is widely regarded throughout the industry as a master programmer. Code Complete 2 is his collection of all the important best practices he's seen and used, backed up with the years of research he's collected from university professors, friends, industry studies, and numerous books and periodicals published over the last several decades. From project management guidelines to step-by-step directions for constructing complex nested loops, McConnell condenses the best practices of the programming industry with down to earth explanation.

I'm still devouring it, but in the middle of my redesign, it seemed ludicrous not to incorporate some of his recommendations. McConnell particularly calls out variable names as a practice in dire need of improvement across the industry and his accompanying 30+ pages set forth the beautifully common sense principles that I've now incorporated into my code. Variable names and OO-CSS are my first steps toward upgrading Earth Chronicle, but it gives me a chance to test them now; it also safeguards me by incorporating these changes now so that they'll be incorporated into every page I build from my templates into the future. That's less work I'll need to do upgrading them later, and it lets me focus on deploying new best practices in upcoming upgrades. If you're interested in programming, I cannot recommend Code Complete 2 highly enough; it's without question the most informative book on the subject I've ever picked up. I'd say you need no other reason to get it, but in addition the writing is crystal clear, and the book is thoroughly sprinkled with (something usually unheard of in computer texts) references to studies that prove almost every qualitative point he sets makes.

Inline Styling

Every update is not just an event, it's an entire process. Many things build up until the decision is made to push the changes across the website. Clearly, the new design upgrades triggered the decision to push, but there are a number of changes that were made before the design was started; some of these important changes, notably the navigation skip link, were worked into the design demo rather than the other way around.

As you see on the CSS Tips page, we've been reminded that there is a <code> element in XHTML. We hadn't used it for a couple reasons, one of them just silly reticence to use anything besides a span element. There are so many deprecated inline elements that make it difficult to assess which are safe and which aren't, especially when most of them have such limited application. Two, in the odd moments when we did consider that <code> might be appropriate for all the occasions when we do write up code on pages, we needed to be able to push the indents and block sections around using margins. That took time, and with a solution already in place it wasn't high priority. However, <code> tag is just a display:block away from being able to do all the same things, sort of. We've now put the time in to make them work properly without eliminating the ability to use <code> tags inline, their native state. Here are the results.

This is a line of code
This is another line of code
This is an indented line of code
This is another indented line of code
This is another line of code
This is the first line of code in a new block
This is another line of code in a new block
This is an indented line of code
This is another indented line of code

We've also stabilized our modification techniques. Inserted content is inserted with a normal inline <ins> tag. Deleted content is modified with a normal inline <del> tag. Each is followed by a <cite class="editRef">[chroniclemaster1, 2009/10/27]</cite> to render an inline reference like so. [chroniclemaster1, 2009/10/27] Further, now that this is stable, we've created .ins and .del classes which can be applied to block level elements too. This replaces a host of editedContent, obsolete, etc. classes which we've used at various times. It's more consistent and easier to remember by using the tag names of the inline elements for the classes which replicate their functions at the block level. Either modification is followed by a trailing paragraph to note the reference, <p class="editRef">[chroniclemaster1, 2009/09/18]</p> like so...

This is a demo of an inserted paragraph.

This is a demo of a deleted paragraph.

[chroniclemaster1, 2009/09/18]