Chapter 9. Design Tips for Working with Joomla!

In this last chapter, let’s sum things up by giving you a few final design tips, tricks, and troubleshooting ideas that you can use in your future Joomla! template designs. As we’ve gone through this book, quite a few tips have been given to you, and here are the top four to remember:

  1. Create and keep lists: Check lists, color lists, font lists, image-treatment lists from your initial design phase should be kept handy. You’ll find them to be useful and an excellent inspiration for your designs to come.

  2. Design for Firefox first and then fix for IE: Firefox is more than a browser preference; it’s a true web designer and developer’s tool.

  3. Validate your XHTML and CSS often: The more stable your markup and CSS, the less hacks and fixes you’ll need to make.

  4. Consider usability issues when implementing site enhancements: Steve Krug is a cool guy.

With that said, let’s just go over a few last design techniques that any good designer wants in his or her arsenal these days.

The Cool Factor

In the subsequent sections, I’ll go through what I feel are the most popular tricks used in website design today. Most are easily incorporated into Joomla! as they are handled 100% via CSS. A few items will require you to think and plan ahead, as you’ll need to make sure the Joomla! template code accommodates the effect. The best thing is that if you can implement these techniques in a Joomla! template, then you can implement them in any website.

Rounded Corners

Rounded corners have been pretty popular in the past few years, to the point that many sites have been accused of incorporating them just so that they seem “Web 2.0-ish”. Fads aside, rounded corners are occasionally just going to work well with a design. (They’re great for implying happy-friendly-ish tones or retro styles.) So you might as well know how to incorporate them into your Joomla! template.

The Classic: All Four Corners

The classic way to handle rounded corners with CSS is to make sure the module is using the -3 $style selector (discussed in Chapters 3 and 6) and then use the divs Joomla! outputs to set the four corners of the box in place.

Note

Really understanding rounded corners in a table-less design? If you haven’t noticed by now, I’m a fan of aListApart.com, so I’ll leave it to these trusted experts to give you the complete lowdown on the ins and outs of making rounded-corner boxes with pure CSS: http://www.alistapart.com/articles/customcorners/.

Also, there are many rounded-corner-generator sites out there that will do a lot of the work for you. If you’re comfortable with CSS and XHTML markup, you’ll be able to take the generated code from one of these sites and massage the CSS into your Joomla! CSS. RoundedCornr. com is my favorite: http://www.roundedcornr.com/.

Use Photoshop or your favorite graphic editor to make four rounded-corner images. This is usually best done by using the square-shaped drawing tool, which also has the option of letting you set the amount of roundedness for your corners. You’ll then make slices of each corner and output them as GIF files. You can also generate your images by using the following URL: http://roundedcornr.com. Name your new images: left-bot.gif, right-bot.gif, left-top.gif, right-top.gif and reference them in the following CSS, which will place each image into a corner of each of your Joomla! output module divs:

module {
    background: #cccccc;
    background: url(../images/left-top.gif) no-repeat top left;
    /*be sure to set your preferred font requirements*/
}
.module div {
   background: url(../images/right-top.gif) no-repeat top right;
}
module div div {
    background: url(../images/left-bot.gif) no-repeat bottom left;
}
module div div div {
    background: url(roundedcornr_170953_br.png) no-repeat bottom
                                                              right;
}
module div div div, .module div div, .module div, .module {
    width: 100%;
    height: 30px;
    font-size: 1px;
}
module {
    margin: 0 30px;
}

The markup Joomla! outputs with a -3 $style looks something like this. (I’ve added comments so that you can see which div will have which image associated with it. These comments will not be in your Joomla! output.)

<div class="module"> <!--//left-top.gif-->f
<div> <!--//right-top.gif-->
    <div> <!--//left-bot.gif-->
        <div bot right> <!--//right-bot.gif-->
            <h3>Header</h3>
                Content goes in here
        </div>
    </div>
</div>
</div>

Using Two Images Instead of Four

This is an advanced technique brought to you by the folks at Compass Designs (http://www.compassdesigns.net/). Its key feature is that only two images are used (and yet it scales vertically and horizontally). On the whole, it’s similar to the four-corner technique, and it still requires the module $style to be set to -3, but if you make your images compressed there’s a bandwidth advantage in only having to load two images instead of four.

Create two images: left-side.gif and right-side.gif following the guidelines in Figure 9.1. Make sure that when the left-side.gif and right-side.gif are placed together (side by side), the whole rounded-corner image is as large as you would expect any area that uses this effect to be. For example, if the largest rounded-corner area you’re expecting to accommodate is 400 pixels wide by 500 pixels tall, make sure that the total of left-side.gif and right-side.gif equals 400 pixels wide by 500 pixels tall; otherwise, you’ll end up with gaps in your rounded-corner effect.

Using Two Images Instead of Four

Figure 9.1 Sample left and right side images

You’ll then reference these two images in the following CSS, which again, places each image as a background for the module divs that Joomla! outputs:

module{
    background: url(../images/right-side.gif) top right no-repeat;
    padding:0;
    margin:0 0 10px 0;
    /*be sure to set your preferred font requirements*/
}
module h3 {
    margin:0;
    padding:0 0 4px 0;
    border-bottom:#ccc 1px solid;
}
module div {
    background: url(../images/left-side.gif) top left no-repeat;
    margin:0;
    padding:6px 0 0 0;
}
module div div{
    background: url(../images/left-side.gif) bottom left no-repeat;
    padding:0 0 0 5px;
}
.module div div div{
    background: url(../images/right-side.gif) bottom right no-repeat;
    padding:0 5px 5px 0;
    height:auto !important;
    height:1%;
}

The Two-Image “Cheat”

I’ll be honest. I’m on the cheater’s bandwagon when it comes to rounded corners. I often create locked-width designs, so I always know exactly how much room my columns can take up. Moreover, I really like using the -2 module $style instead of the -3 $style, as I feel that the less markup the better.

Note

More A List Apart: Again aListApart.com comes in with a great take on this two-image process along with some great tips for creating the corners in your favorite graphic program: http://www.alistapart.com/articles/mountaintop/.

This rounded-corner fix only requires the -2 $style to be called and only works for a set width with a variable height. This means that however wide you make your graphic, say 250 pixels wide, that is the maximum width that your module can be to accommodate this rounded-corner effect.

So, if you know the width of your columns and just need the height to expand, you can perform this two-image cheat by only making a top image and an extended bottom image as shown below:

The Two-Image “Cheat”

Figure 9.2 sample top and bottom images

Next, reference the images in your CSS so that they are associated with the Joomla! module divs:

module {
    margin:0 0 10px 0;
    padding:0 0 10px 0;
    width: 150px;
    background:url(../images/bot-side.gif) bottom left no-repeat;
    /*be sure to set your preferred font requirements*/
}
module h3 {
    padding:8px 10px 6px 15px;
    margin-bottom:8px;
    /*be sure to set your preferred font requirements*/
   background:url(../images/top-side.gif) top left no-repeat;
}

Note

Great for block quotes! I also use this technique to handle the custom block quotes that are used inside static pages and articles (a great way to spice up pages so that they look “magazine-ish”). Again, the block quotes must be a set width, but I then only need to make sure I place my <blockquote> and <h3> tags to have an effective style with minimal (and semantic) markup. Just replace the .module{... mentioned earlier with blockquote{... (or make a special class to assign to your <blockquote> tag).

I Don’t Want Rounded Corners on all My Modules!

You can customize each type of module by adding its own suffix, allowing you to draw attention to a particular module with rounded corners (or any other special CSS).

In the Joomla! Administrator’s Panel, go to Modules | Site Modules and select the module that you want to focus on in your design (in our case, Polls).

Underneath the module’s Details area, you’ll see the Parameters area. There, you can create a Module Class Suffix to append to that module.

I Don’t Want Rounded Corners on all My Modules!

Figure 9.3 Setting a Module Class Suffix

You’ll now be able to target that module (and any others that you customized with a suffix) using the specific module-suffix name that you created for it as follows:

module-polls {
    margin:0 0 10px 0;
    padding:0 0 10px 0;
    width: 150px;
    background:url(../images/bot-side.gif) bottom left no-repeat;
}
module-polls h3 {
    padding:8px 10px 6px 15px;
    margin-bottom:8px;
    /*be sure to set your preferred font requirements*/
    background:url(../images/top-side.gif) top left no-repeat;
}

Now only our Polls module has rounded corners on it, drawing attention to it, while the rest of our site modules have our existing module standards.

Sizeable Text

Sizable text is a fun feature to provide your users with. I’m not big on this feature as being able to size screen text is built in with all browsers. However, many people don’t know this and the occasional low vision user will love you as well as the design purist who wishes every website was set in pretty, little 8 pixel type. (Who says you can’t make everyone happy?)

First, set a default font size on your CSS body rule. By default, most browsers will set all your text to be medium sized. This is roughly like setting your font size to about 16px, which I find quite big.

You’ll get around this by setting your initial font size in the body tag to a percentage less than 100% (which again, is about 16px). It turns out that the “atypical” visual designer in me prefers those layouts with tiny type as well (but I try to stop at 10px, not 8px), so I find setting the body tag to about 62.5% works well. (If it’s too small, they can resize it; that’s the whole point!) Many sample tutorials on the Web like to start you off at 76%, but in reality, you can set it to any percentage you like so long as your basic font size is sensible. (If you like the big type, then go ahead and set it to 100%).

body { font-size:62.5%; }

Next, you will need to stop referencing your font sizes in pixels (or points or anything absolute) from here on out and use the em size unit. By setting your initial size using the relative percentage, you will then be able to accurately size your text up and down from that percentage using the em size unit.

div { font-size: .8 em; }

Note

What’s so great about em sizing? The em size unit refers to the length-size (a.k.a. the horizontal-size) of the font (or other horizontal/length-sized elements you can apply it to). Whether you are offering sizable text or locking your text size in, be sure to pick a size method (em and % or px and points) and then stay consistent. You should not be mixing absolute (points or pixels) and relative (em and percentage) sizes together in your CSS. This will cause layout issues down the road. For more information, check out Eric Meyer’s article: Font Sizing. http://meyerweb.com/eric/articles/webrev/199912.html.

Last, you need to ensure that your layout grows and shrinks with your sized text. You’ve removed the absolute sizes from your fonts, so be sure not to have any absolute fixed heights on your content div containers. The easiest way to check for this is to view your layout in the browser and using the browser’s controls, make the text size bigger and smaller and ensure that your divs grow and shrink with the new text size. You can also do a “Find and Replace” in your CSS for px and pt to make sure that you didn’t accidentally leave anything as a fixed font or div height.

Once your template is accommodating all of the above, you will need some graphics indicating that you can make text larger and smaller i.e.: “A+” and “A-”, and a “Reset” graphic. You will then need to download the following script. (I’ll tell you what to do with it in a second.)

http://forum.joomla.org/Themes/joomla/md_stylechanger.js

You will need to place that file in the template directory you are using. (As it’s a JavaScript file you should have a js directory in your template folder. Also, make sure to update your templateDetails.xml file.)

Then, place your A+, A-, and Reset images in your template’s image directory.

Note

Keeping the templateDetails.xml file updated If you have not updated it, you should be updating it! Each time you create a new graphic that is going to be used by the index.php template and CSS file(s), or add a new JavaScript or CSS file, you must be sure to update your templateDetails.xml file. Getting in the habit of keeping this file maintained will make your life much easier when it is time to package the template and hand it over to the client!

Next, paste this bit of code (based on r0tt3n’s Joomla! forum FAQ: http://forum.joomla.org/index.php/topic,36474.0.html) in your template’s index.php file in the location where you want the sizers to be visible.

This code will display your new text-sizing graphics and when they are clicked, execute the JavaScript code, which resizes the text and makes it smaller and bigger.

Be sure to update the bold areas with the correct path and file names:

<script type="text/javascript" language="javascript"
                  xsrc="<?php echo $mosConfig_live_site;?>/templates/
                  <?php echo $mainframe->getTemplate();?>
                  /js/md_stylechanger.js">
</script>
<a xhref="index.php" title="Increase size"
                           onclick="changeFontSize(1);return false;">
<img xsrc="<?php echo $mosConfig_live_site;?>/templates/
                    <?php echo $mainframe->getTemplate(); ?> /images/
                    name of your A+ image here" alt="" border="0" />
</a>
<a xhref="index.php" title="Decrease size"
                          onclick="changeFontSize(-1);return false;">
<img xsrc="<?php echo $mosConfig_live_site;?>/templates/
                    <?php echo $mainframe->getTemplate(); ?> /images/
                    name of your A- image here" alt="" border="0" />
</a>
<a xhref="index.php" title="Revert styles to default"
                             onclick="revertStyles(); return false;">
<img xsrc="<?php echo $mosConfig_live_site;?>/templates/
                  <?php echo $mainframe->getTemplate(); ?> /images/
                  name of your Reset image here" alt="" border="0" />
</a>
Sizeable Text

Figure 9.4 Resizable Text Buttons As Seen On Joomla.org

Graphic Header Text

Now here’s something that’s a total pain for all web designers. There are only three or at the most maybe five truly safe fonts for the Web. You can be fairly sure that every PC and Mac (and maybe Linux) computer has these fonts natively installed. All other fonts tend to be off-limits for web design. This is a shame as typography is a huge element of great design. Nonetheless, if you want these fonts, you have to create them as graphics and include the images in your layout.

The problem with using graphics instead of text—it is usually the headers that you want in the pretty font. However, if you use inline image tags, your semantic markup gets thrown off and your SEO will fall, because SE bots really like to find these header tags to help them assess the real keywords in your page. Also, if your style aesthetic changes, you not only have to change the template but also update individual content pages with new images.

The solution is to use text in your header tags and set up custom classes in your style sheet that will move the text out of the way and insert your graphic font as a background image instead. So your XHTML markup will look like this:

<h3 class="newsFlash">Newsflash 3</h3>

This is great for disabled people, people who browse using text-only browsers, and let’s not forget, our SE bot friends. But, for everyone else, the CSS will place the background image and move the text aside so they see your pretty layout with headers that use your cool font. The bonus is that when the site design changes, all your images are handled via the CSS so you won’t have to touch individual article and content pages.

Say you’ve made a few of these graphic headers:

Graphic Header Text

Figure 9.5 Font Graphic

In your CSS, set up the following class rules, which will set up your standard placement and position your graphic-font images:

.textMove{ /*this is your standard for each header*/
height: 23px;
margin-top:10px;
width: 145px;
text-indent: -2000px;/*This pushes your text back so it's invisible*/
}
.flash3{ /*specific header-text image*/
  background: url("../images/flash3.jpg") no-repeat left top;
}

In your Joomla! Administration Panel, for the content pages you’d like to apply this technique, apply the appropriate class to the header(s) that you place in the body text area of the editor. (Again, turn off the WYSIWYG editor to do this.)

<h2 class="noHead flash3">Newsflash 3</h2>

Note

Assign more than one class rule to an XHTML markup object. As you can see from our sample above, you can assign more than one class rule to a markup object. Simply separate each class rule with a space (not a comma) e.g.: class="rule1 rule2". This comes in handy when you need to customize many elements, but don’t want to repeatedly copy similar properties across all of them. (Also, you can easily change the main properties in just one place instead of having to fix them all.) In the case of graphic-text headers, I like to make one rule that handles pushing the text out of the way and sets the height and margins for my header images so that all my other class rules just handle the background image name: class="textMove moreText".

Graphic Header Text

Figure 9.6 Header Graphic In Page

Note

What about my Module headers? You need to be able to control an id or class attribute in a table or div tag, in order to call in a background graphic via CSS. That’s why it’s so easy for us to place consistent background images behind our module headers, but targeting them to place actual graphic text takes a little extra effort. To use this trick with module headers you will need to give each module a special suffix (please refer to the Rounded Corners section) and then target the h3 tag under that module-suffix: .module-suffixName h3 {.... Of course, you can’t target your module headers with two classes as we did in our above example but you will still get your graphic-font in there.

Note: This technique can get a little complicated if you want rounded corners on the module and a graphic header, but as you’re creative, you’ll quickly see how to accommodate that (please refer The Two-Image “Cheat” section). For headers used in page content, I just turn off the Show Title feature available for many module and content items and add the header manually to the content text area.

Using PHP to Make Graphic Headers Easy

I like to simplify this process by using a simple PHP script with a local TTF (TrueType Font) font to help me quickly generate my header graphics. I can then just include them into my CSS sheet, dynamically setting up the text that the header needs to say.

This technique is very useful if your site is going to be mainly controlled by a client, as they will probably have to let you know every time they make a new header that needs to be a graphic loaded in via CSS. You will be able to accommodate them on the fly (or even better, teach them how to do it) as opposed to having them wait for you to generate the graphic with Photoshop or Gimp and then implement the CSS.

Note

Heads up: This PHP code requires the standard ImageGD library to be installed with your PHP configuration. (Contact your website host administrator to ensure the ImageGD library is installed.)

You can place this script’s file anywhere you like. I usually place a script like this in my template’s image directory as I will be referencing them as images (again, update your templateDetails.xml file).

imgtxt.php:
<?php
/*Basic JPG creator by Tessa Blakeley Silver.
Free to use and change. No warranty.
Author assumes no liability, use at own risk.*/
header("Content-type: image/jpeg");
$xspan = $_REQUEST['xspan'];//if you want to adjust the width
$wrd = $_REQUEST['wrd'];//what the text is
if (!$xspan){//set a default width
    $xspan = 145;
}
$height = 20;//set a default height
$image = imagecreate($xspan, $height);
//Set your background color.
//set to what ever rgb color you want
if(!$bckCol){
    $bckCol = imagecolorallocate($image, 255, 255, 255);
}
//make text color, again set to what ever rgb color you want
if (!$txtCol){
    $txtCol = imagecolorallocate($image, 20, 50, 150);
}
//fill background
imagefilledrectangle($image, 0, 0, $xspan, $height, $bckCol);
//set the font size on the 2nd parameter in
//set the server path (not the url path!) to the font location at the
//7th parameter in:
imagettftext($image, 15, 0, 0, 16, $txtCol,
"home/user/sitename/fonts/PLANE___.TTF", "$wrd");//add text

imagejpeg($image,'',80);//the last number sets the jpg compression
//free up the memory allocated for the image.
imagedestroy($image);
?>

Note

This script only works with TrueType fonts. This PHP script is written to generate an image with a background color of your choice and the TrueType font you specify, in the color of your choice. Upload the TrueType font and directory location that you referenced in the script to the matching location on the server.

From here on, you will only need to reference this PHP script in your CSS, passing your text to it via a query string instead of the images that you were generating:

flash3{
    background: url("../images/imgtxt.php?xspan=300&wrd=Newsflash 3")
                                                no-repeat left top;
}

Each time you have a new graphic to generate, you can do it entirely via the template’s style sheet and the Joomla! Administration Panel.

Using PHP to Make Graphic Headers Easy

Figure 9.7 Header Graphic In Page. Looks the same. But it’s not!

Note

Additional Template Tricks and Tutorials: Compass Designs (the creator of the first two-image technique) makes professional, commercial Joomla! templates. (You pay for them, but they are really nice templates.) Compass Designs is also great in that they share knowledge liberally with the community. If you’d like to learn more design tricks for Joomla! check out their site’s tutorial section:

http://www.compassdesigns.net/tutorials/joomla-tutorials/.

Advanced Tips

At this point you can get just about anything you can imagine into your Joomla! template and site. In this last section we will just go over a few final advanced tips and tricks, and some troubleshooting items you are bound to run into (eventually, anyway).

Common WYSIWYG Editor Issue

Imagine this scenario. You have designed the most beautiful, slickest, coolest Joomla! site ever. Congratulations. It’s complete with an awesome, rich, dark background. Instead of fawning over your great masterpiece, the client calls you back complaining that they can’t add or edit content because the editing area is filled with your rich, dark background. You, who turned off your WYSIWYG editor so you could add in Flash, AJAX techniques, or Lightbox JS code, didn’t notice this.

Basically, the Tiny MCE editor that comes with Joomla! and the third-party editor, JCE (Joomla! Content Editor), both pull the template_css.css sheet so that content editors can style their text with a pull-down menu of CSS style. The style sheet is also applied to the edit area window. On the whole, this makes the What-You-See-Is-What-You-Get, a little more accurate (which is a good thing). This is fine if you have a white or very, very light background color assigned to your CSS body rule, but if you have a dark background color or repeating image assigned to the body rule, the background of your WYSIWYG edit pane takes on that color, or image repeat (which is a bad thing).

This gets particularly troublesome as you will generally have the text inside a content container div that has a lighter background color assigned to it, with a dark font color over that. This content container div isn’t present in the editing window and the general result is a dark background color with dark text over it in the edit pane:

Common WYSIWYG Editor Issue

Figure 9.8 Impossible To Edit!

There’s an easy fix for this, the TinyMCE editor, which only sniffs out the template_css.css sheet. So anything that isn’t in that style sheet will not affect the WYSIWYG edit area. Simply remove your body rule from the template_css.css sheet and place it in a separate style sheet: body.css. If by some chance you notice other styles are adding confusion to your WYSIWYG edit pane, you can remove those as well and add them to the new style sheet. You then just have to make sure that your index.php file calls in both the style sheets. (If you are also including IE fix style sheets this is nothing new to you.)

Note

Once you made this fix, be sure that your templateDetails.xml file is updated to accommodate the additional style sheet! Also, a developer’s comment in the main template_css.css sheet would be nice in case the Joomla! site ever has another designer or developer working with it.

What About SEO?

At this point you’ve gone through the trouble to create a semantic, user-friendly, accessible XHTML template structure and one of the benefits of this structure is that it helps with SEO (Search Engine Optimization, if you haven’t guessed by now). You might as well go all out and take advantage of the built-in SEO features Joomla! has to offer.

URLs

Joomla! URLs are dynamic by default. This means they are a query string of the index.php page: index.php?option=com_poll&task=results&id=14.

In the past, dynamic URLs had been known to break SE bots that either didn’t know what to do when they hit a question mark or ampersand or started indexing entire sites as “duplicate content” because everything looked like it was coming from the same page (the index.php page). Generally, this is no longer the case, at least not with the “big boy” search engines but you never know who is searching for you using what service.

Also, by changing the dynamic string URL to a more SEF (Search Engine Friendly) URL, its a little harder for people to directly manipulate your URLs because they can’t clearly see which variable they’re changing once it’s in an SEF URL.

Joomla! has this SEF URL feature built-in (but only if you’re running PHP on Apache). First, you have to go into the root of your Joomla! installation and change the name of your htaccess.txt file to just .htaccess.

Next, in your user administration panel go to Site | Global Configuration and click on the SEO tab. Under Search Engine Friendly URLS, select Yes. You’ll notice that your URLs now display something more along the lines of: index.php/com_poll/results/14/.

SE bots will think the forward slashes are directories and not freak out about question marks and ampersands or assume that everything on your site is really the same page.

Note

Forget the SE bots! What about People Friendly URLs? Yes, that is a problem with the current 1.0.x version. It’s not exactly easy to just tell someone where your hot new article is, if it’s a series of forward slashes, bizarre abbreviated words, and numbers. Also clearly named URLs greatly boost your link trust (that’s what I call it anyway). If the link you’ve emailed people or posted in your blog doesn’t appear to clearly have any indication of what you have promised to be in it, people are much less likely to click on it. Even though the impact of keywords in URLs seems to be waning, there are SEO experts who still swear that your URLs should contain the top keywords in your document. ARTIO JoomSEF is a third-party component that’s helpful in cleaning up Joomla! URLS into “PF” URLs.

http://www.artio.cz/en/joomla-extensions/artio-joomsef

Keywords and Descriptions

The effectiveness of placing keywords into your meta-tags is now widely disputed. (Since it’s so easily subject to misuse and manipulation, there’s even speculation that perhaps the big search engines don’t reference this meta tag at all anymore.) I therefore feel that it’s still wise to place your major keywords into a tag. (Again if nothing else, the smaller, lesser-known search engines may still use them.) I’m not so big on targeting misspellings anymore as the major search engines compensate for misspellings but some people still say it’s important. (Don’t you just love the “exact science” of SEO?)

However, I do find a well-written meta description useful as it seems search engines may randomly choose to display your meta description instead of the relevant bit of text on the page that pertains to the keyword search someone just performed.

When it comes to these two meta tags, I’m an advocate of “less is more”. Do not drop in 200 keywords and a four paragraph description into your meta tags. Simply put in the top 5 to 10 keywords used in your article or page, as well as a one sentence description (or possibly two sentences) that contains at least 3 to 5 of those keywords. Anything more than that, and I believe the GoogleMonster will assume you’re trying to pull some SEOBlackHat stunt and ignore fully indexing your pages.

You may have noticed in your Joomla! Administration Panel, when you edit or create a new content page (be it an article, static page or even a wrapper) there’s a side panel off to the right.

If you click the Meta Info tab, you’ll have two areas to include your content page’s description and keywords.

Keywords and Descriptions

Figure 9.9 Meta Info Panel in Edit Content Screen

For advanced SEO control over your content and help with generating keywords and meta tags (which is always a pain to do), there’s an excellent plug-in extension that I’ve found useful called JoomlaSEO. You can get it from here: http://www.joomseo.com/.

Ways to Remove More Tables from Joomla!

Throughout the course of this book, we’ve showed you how to remove as many tables as possible from your Joomla! design. At this point, there are probably no tables in your template at all, however, anything that is output in the mainBody(); tag is still going to be wrapped in several tables.

If you feel at this point, you’re quite the Joomla! template pro and you really want to try and go for an all table-less layout or you are unhappy with certain aspects that the mainBody(); tosses out at you, you can modify it.

Note

Warning: If you’re going to open this file and muck around in it, do the following:

  1. Back up the file so that you can revert back to it if you break it.

  2. Make sure that you are comfortable and understand the difference between HTML markup and PHP code.

  3. Only touch the HTML markup and not any of the PHP code (unless you’re also a PHP wizard and intentionally want to change it, in which case, make sure that you did Step 1 before you change it).

  4. Remember, any changes you make to these files will probably be lost if you ever upgrade your Joomla! installation (so have an upgrade plan if the changes are crucial).

In your Joomla! root directory, locate the following directory and file:

/components/com_content/content.html.php.

In this file you’ll see the entire table code that Joomla! uses to wrap content in. Here you can strip and replace table tags for div tags as you see fit. For example, the following code comes from the content.html.php file (starting on line 41 and continuing to line 64):

if ( $params->get( 'page_title' ) ) {
            ?>
            <div class="componentheading<?php echo $params->
                                         get( 'pageclass_sfx' ); ?>">
            <?php echo $title->name; ?>
            </div>
            <?php
        }
        ?>
        <table width="100%" cellpadding="0" cellspacing="0"
                               border="0" align="center"
                               class="contentpane<?php echo $params->
                               get( 'pageclass_sfx' ); ?>">
        <tr>
            <td width="60%" valign="top"
                        class="contentdescription<?php echo $params->
                        get( 'pageclass_sfx' ); ?>" colspan="2">
            <?php
            if ( $title->image ) {
                $link = $mosConfig_live_site .'/images/stories/'
                                                       $title->image;
                ?>
                <img src="<?php echo $link;?>" align="
                                <?php echo $title->image_position;?>
                                " hspace="6" alt="
                                <?php echo $title->image;?>" />
                <?php
            }
            echo $title->description;
            ?>
            </td>
        </tr>
        <tr>
            <td>(... code continues)

By leaving the PHP in place, you can see how to remove the table and table cells to insert more friendly XHTML structures.

More Ways to Edit Joomla’s XHTML Markup

While we’re here poking around the /components/ directory, you will find many other com_componentName folders: from com_banners to com_wrapper. Inside each of these directories, you may or may not find a componentName.html.php file.

The files that have html in their name are output files that contain the HTML markup that Joomla! uses to wrap content in. You can edit these files just like the content.html.php file that we described earlier.

Note

Remember, everything in the /compontents/ folder only affects items output by the mainBody(); code. For example, if you edit the polls.html.php file, the Polls displayed in your side bar will not be affected. Only the Polls Results display (which shows up in your mainBody();) will change. Again, unless you are a bonafide PHP wiz and know exactly what you’re doing, be careful with these files, follow the steps in the information box above, and only work with components that offer componentName.html.php files.

Final Note On Customizing the mainBody();

There is one last thing to consider before you indiscriminately start stripping down the markup of your Joomla! mainBody(); output: The Joomla! CMS was put together by a great Joomla! team of expert PHP coders and web developers with some careful thought. Therefore, they probably had many good reasons for including the core component code and markup that they did. Just be aware that changing this output in any way can affect how the Joomla! CMS works and looks on the whole. For instance, if your site’s editors and contributors are going to be heavily reliant on the WYSIWYG editor (which is very likely), keep in mind that some of the markup produced by the editor may not look good if it’s not contained in a table. Be prepared to do lots of testing if you customize any of these files to make sure that the content display and site features continue working and look as everyone expects them to.

Summary

There you have it—all there is to know about making templates with Joomla!. In this chapter we reviewed the main tips you should have picked up from the previous chapters as well as covered some key tips for easily implementing today’s coolest CSS tricks into your template. We also looked at a few final fix them tips that you would probably run into once you turn the site over to the content editors. I hope you’ve enjoyed this book and found it useful in aiding your Joomla! template creations.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.161.225