Home > Articles > Web Development > Content Management Systems

This chapter is from the book

Making a Real Joomla! 1.5 Template: CSSTemplateTutorialStep3

You need to start with a comp. A comp, short for composition, is a drawing or mockup of a proposed design that will be the basis of the template. In this section, you will be using the Bold template, kindly donated by Casey Lee, the lead designer from Joomlashack (www.joomlashack.com), and you can see it in Figure 9.8.

Figure 9.8

Figure 9.8 A design comp from Joomlashack.

Slicing and Dicing

The next step in the process is slicing. You need to use your graphics program to create small sliced images that can be used in the template. It's important to pay attention to how the elements can resize if needed. (My graphics application of choice is Fireworks because I find it better suited to web design—as opposed to print design—than Photoshop.)

This process is probably a whole book in itself. To get a sense of how to slice up a design, you can look at the source PNG file in Fireworks for the template and you'll be able to see the slices.

Setting Up Module Locations

The Bold template will have some specific locations for specific modules, slightly different from the standard Joomla installation. To make sure the modules are correctly set up as you work through this template, you need to designate the following positions:

  • User1 for the search module
  • User2 for the top menu
  • Top for a newsflash or custom HTML module

Nothing else should be published in these locations. (Quickly scan position assignments in the Module Manager and reposition or disable modules as necessary.)

Header

The header image has a faint swish at the top. We put the image in as an untiled background and then assign a matching fill color behind it. That way, the header can scale vertically if you need it to (for example, if the fonts are resized). You also need to change the color of any type to white so that it will show up on the black background.

You will also use another background image for the search box. You need to make sure to target the correct input by using CSS specificity. You can also use absolute positioning inside a relatively positioned element to place the search box precisely where you want it. The image will not scale with text resizing using just a single image. That would require a top and bottom image and what's known as the sliding doors technique—and that's another exercise for you!

Here is the CSS we must add to style the header:

#header {
   color:#fff;
   background:#212121 url(../images/header.png) no-repeat;
   position:relative;
   }
#header h1 {
   font-family:Arial, Helvetica, sans-serif small-caps;
   font-variant:small-caps;
   font-stretch:expanded;
   padding-left:20px;
   }
#header input {
   background:url(../images/search.png) no-repeat;
   border:0;
   height:22px;
   width:168px;
   padding:2px;
   font:1em Arial, Helvetica, sans-serif;
   }
#header .search {
   position:absolute;
   top:20px;
   right:20px;
   }

You did not use a graphical logo here; you use plain text. The reason is mainly because search engines cannot read images. You could do some nifty image replacement, but I will leave that as an exercise for you to do on your own.

The header now looks as shown in Figure 9.9.

Figure 9.9

Figure 9.9 Header image background.

Next, you need to implement a technique to show a background on a fluid column: sliding doors.

Column Backgrounds

Recall that when you put a color background on the columns, the color did not extend all the way to the footer. This is because the div element—in this case, sidebar and sidebar-2—is only as tall as the content. It does not grow to fill the containing element.

You have to use a technique called sliding faux columns, with which you essentially create two wide images that will slide over each other. You need to create two new containers to hold the backgrounds. Normally, you could apply one to the #wrap div that contains our entire page content, but here we use an extra (and wasteful) container for illustration purposes.

For a full description, you can check out these two guides:

In this case, the maximum width is 960 pixels, so you start with an image of that width. In the image source files, it is slidingcolumns.png. You then export two slices (you can use the same slice and just hide/reveal the side images), one 960 pixels wide with a 192-pixel image for the column background on the left, and one 960 pixels wide with a 196-pixel image for the column background on the right.

Where does 192 pixels come from? It's 20% of 960 (because the columns are 20% wide).

You use the background-position property to place the images in the correct place. Here, you are using condensed CSS format, so they are part of the background property:

#leftfauxcol {
   background:url(../images/leftslidingcolumn.png) 20% 0;
   }
#rightfauxcol {
   background:url(../images/rightslidingcolumn.png) 80% 0;
   }

In your index.php file, you simply add an inner container inside the wrap:

<div id="wrap">
  <?php if($this->countModules('left')) : ?>
  <div id="leftfauxcol">
    <?php endif; ?>
    <?php if($this->countModules('right')) : ?>
    <div id="rightfauxcol">
      <?php endif; ?>
      <div id="header">

You also need to put a conditional on the closing divs:

      <?php if($this->countModules('right')) : ?>
    </div><!--end of rightfauxcol-->
    <?php endif; ?>
    <?php if($this->countModules('left')) : ?>
  </div><!--end of leftfauxcol-->
  <?php endif; ?>
</div><!--end of wrap-->

You must also put a background onto the footer and bottom modules/elements; otherwise, the column background would be shown:

#footer {
   background:#212121;
   color:#fff;
   text-align:right;
   clear:both;
   }
#bottom {
   background:#333;
   color:#666;
   padding:10px 50px;
   }

You need to clear the floats so that the float container (the faux columns) will extend to the bottom of the page. The best method for doing this is to use the property :after (see www.positioniseverything.net/easyclearing.html). But with the release of Internet Explorer 7, this method will not work completely.

A couple of solutions have been found (see www.quirksmode.org/css/clearing.html and www.sitepoint.com/blogs/2005/02/26/simple-clearing-of-floats/). You can use the float (nearly) everything option (see www.orderedlist.com/articles/clearing-floats-the-fne-method/).

Thus, you add a simple clear:both to the #footer, and you add floats to the fauxcol wrappers.

/*Compass Design ie6only.css CSS*/
#leftfauxcol {
   float:left;
   width:100%;
   }
#rightfauxcol {
   float:left;
   width:100%;
   }
#footer {
   float:left;
   width:100%;
   }

Flexible Modules

Let's dig more deeply into adjusting the appearance of modules by setting display options and talk about the concept of chrome. Chrome is the nickname for giving content a stylized appearance, and Joomla has some built-in features that help you both eliminate tables from the layout and style in some shiny chrome. In your design, at the top position, you have a large initial module block. You don't know how tall the text that is needed will be. To solve that problem, you put the module jdoc:include statement in a containing element and give it a background of the same color as the image. This is the same strategy you used for the header:

<?php if($this->countModules('top')) : ?>
<div id="top">
  <div class="inside">
    <jdoc:include type="modules" name="top" style="xhtml" />
  </div>
</div>
<?php else : ?>
<div id="top">&nbsp;</div>
<?php endif; ?>

The CSS needs to use CSS specificity for the .top module styles to override the generic moduletable styles defined earlier. These new styles specifically affect elements with the class moduletable that are descendants of the div with the id of top and would override any contrary settings for these style attributes set more generally for elements with the class moduletable:

#top {
   background:#ea6800 url(../images/teaser.png) no-repeat;
   padding:10px;
   }
#top .moduletable h3 {
   color:#fff;
   background:none;
   text-align:left;
   font:2.5em Arial, Helvetica, sans-serif normal;
   padding:0;
   margin:0;
   font-stretch:expanded
   }
#top .moduletable{
   font:bold 1em/1.2 Tahoma,Arial, Helvetica, sans-serif;
   color:#fff;
   margin:0;
   padding:0;
   border:0;
   }

Now let's focus on some of the typography.

Typography

Many of the links will need to be white, so you can define them as such globally and then modify the color for the center column:

a:link,a:visited {
   text-decoration:underline;
   color:#fff;
   }
a:hover {
   text-decoration:none;
   }
#content60 a:link,#content60 a:visited,#content80 a:link,#content80
a:visited,#content100 a:link,#content100 a:visited {
   color:#000;
   }

The design has a stylized button. You create this by using a background image from the comp. It's a thin slice that is tiled horizontally:

.button {
   border:#000 solid 1px;
   background:#fff url(../images/buttonbackground.png) repeat-x;
   height:25px;
   margin:4px 0;
   padding:0 4px;
   cursor:hand;
   }

For tables, such as a list of FAQs, you can add an easy background by repeating the use of the image you used for the teaser:

.sectiontableheader {
   background:url(../images/teaser.png);
   padding:5px;
   color:#fff;
   font:1.2em bold Arial, Helvetica, sans-serif;
   }

The modules need just a simple redefinition and adjustments to the padding and margins:

/* Module styling */
.moduletable {
   margin-bottom:1em;
   color:#fff;
   font-size:1.1em;
   }
.moduletable h3 {
   font:1.3em Tahoma,Arial,Helvetica,sans-serif;
   background:#000;
   color:#ccc;
   text-align:left;
   margin:0 -10px;
   padding:5px 10px;
   }

Menus, as always, need a lot of style CSS. Here, you should keep it as simple as possible. You can slice a single image that includes both the bullet and the underline. Note that you turn on the styling by applying the module suffix menu to any menu modules that you want this look applied to:

/*Menu Styling*/
.moduletablemenu {
   margin-bottom:1em;
   }
.moduletablemenu h3 {
   font:1.3em Tahoma,Arial,Helvetica,sans-serif;
   background:#000;
   color:#ccc;
   text-align:left;
   margin:0 -10px;
   padding:5px 10px;
   }
.moduletablemenu ul {
   list-style:none;
   margin:5px 0;
   }
.moduletablemenu li {
background:url(../images/leftmenu.png) bottom left no-repeat;
   height:24px;
   font:14px Tahoma,Arial, Helvetica, sans-serif;
   margin:10px 0;
   padding:0 0 0 10px;
   }
.moduletablemenu a:link,.moduletablemenu a:visited {
   color:#fff;
   display:block;
   text-decoration:none;
   padding-left:5px;
   }
.moduletablemenu a:hover {
   text-decoration:none;
   color:#fff;
   background:#ADADAD;
   }

Last is the Tab menu at the top right. As an accessibility advocate, you want to set this up so that the tabs will scale as the font is resizing. Fortunately, a technique has been developed to do this; it's actually the same principle you use for our columns: the sliding doors again (see www.alistapart.com/articles/slidingdoors/)!

You can also try to do some speed optimization for the template and use just a single image for the left and right sides of the "doors," as well as the on and off states. This is known as using sprites (see www.fiftyfoureleven.com/weblog/web-development/css/doors-meet-sprites).

The CSS is not too difficult; you just have to fiddle around with the vertical position of the image background for the on state:

/*Tab Menu Styling*/
.moduletabletabs {
   font:bold 1em Georgia, Verdana, Geneva, Arial, Helvetica, sans-serif;
   }
.moduletabletabs ul {
    list-style:none;
   float:right;
   margin:0;
   padding:0;
   background:#212121;
   width:100%;
   }
.moduletabletabs li {
   float:right;
   background:url(../images/tabs.png) no-repeat 0 -4px;
   margin:0;
   padding:0 0 0 12px;
   }
.moduletabletabs a:link,.moduletabletabs a:visited {
   float:left;
   display:block;
   color:#000;
   background:url(../images/tabs.png) no-repeat 100% -4px;
   text-decoration:none;
   margin:0;
   padding:7px 18px 5px 9px;
   }
.moduletabletabs #current {
   background:url(../images/tabs.png) no-repeat 0 -84px;
   }
.moduletabletabs #current a {
   color:#fff;
   background:url(../images/tabs.png) no-repeat 100% -84px;
   }

You also need to add the module suffix tabs to the module for the menu you are using.

If you look back at the original design, you will notice that there are icons on these tabs. Because you are already using two background images, one on the li and one on the link, you need a third element on which to place the icon background. You could do this by having a span, but because this is advanced CSS Jujitsu, I'll leave it as a homework assignment.

The finished template should look as shown Figure 9.10.

Figure 9.10

Figure 9.10 An advanced template with typography.

Now that you have the basics done, let's start delving into some of the advanced features that are possible with Joomla 1.5 templates.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020