Now that you’ve had some thorough hands-on experience with making templates, you’ve probably noticed that there’s quite a bit of markup that Joomla! spits out. While you can always use your DOM Source Inspector to see what’s going on, it’s helpful to look at the DOM as well. We’ll use this chapter to go over the XHTML markup that Joomla! uses, remind you about how to gain some control over that markup, and look at the standard CSS classes and ID rules that Joomla! references in its markup.
You’ll remember that in Chapter 3 we started our semantic layout by placing our own markup, which was used as “containers” for Joomla!’s markup. Again, those bits of PHP code that look like: mosLoadModules('')
or mosMainBody()
are the ones that end up generating your Joomla! markup.
There are many parts of Joomla!’s output that you can control easily, some that you can’’t control, and some that you can control with a little bit of creativity. Let’s review the list of core Joomla! PHP code, and take a look at the kind of output produced and at the kind of control available.
Markup Output Produces |
Control Options | |
---|---|---|
<?php echo $mosConfig_sitename; ?> |
plain text, no tags. |
You cannot control how this is output. You can just make sure that you wrap the PHP inside |
<?php mospathway() ?> |
|
You cannot control how this is output. See the Classes table for more information. |
<?php mosMainBody(); ?> |
Tables house the content title, print, email, and pdf buttons, article content as well as author, date, and next, back, and other navigation. |
You cannot control how this is output. This PHP code can produce a lot of tables and cells depending on the article and or page overview. See the Classes table for more information. |
<?php include_once ($mosConfig_absolute_ path .'/includes/ footer.php'),?> |
|
You can control this, by editing the |
<?php mosLoadModules (''), ?> |
Tables or
Also, classes (depending on the type of module):
|
You can control the module output by taking advantage of the See the Note: The Poll module and Login module will output using the selected |
Pretty much the only things over which you have some output control are your module loaders and your menu items. Right off the bat, you’ll want to think ahead about what kind of output will be most optimal. Next, let’s take a look at our options
We discussed these options in detail in Chapter 3. The $style
option is a numeric value which is placed, after the module position name is called into the PHP code:
<?php mosLoadModules ( 'modName', $style); ?>
$style Variables |
Effect |
Sample |
---|---|---|
|
Modules are displayed in a table with a single row column. This is also the default setting, so you’ll never really need to use it. |
<table class="moduletable" cellpadding="0" cellspacing="0"> <tbody><tr> <th>Title</th> </tr> <tr> <td>Content</td> </tr></tbody> </table> |
|
Modules are again displayed in a table with multiple column rows, giving it the effect of being displayed horizontally, rather than vertically like the default. |
<table> <tbody><tr> <td align="top"> <table cellpadding="0" cellspacing="0" class="moduletable"> <tbody><tr> <th valign="top">Title</th> </tr> <tr> <td>Content</td> </tr></tbody> </table> </td> <!--next table cell starts--> <td align="top"> <table cellpadding="0" cellspacing="0" class="moduletable"> <tbody><tr> <th valign="top">Title</th> </tr> <tr> <td>Content</td> </tr></tbody> </table> </td> </tr></tbody> </table> |
Modules are displayed in plain text without titles. |
Content | |
|
Modules are displayed wrapped in a single |
<div class="moduletable"> <h3>Title</h3> Content </div> |
|
Modules are displayed wrapped in several |
<div class="module"> <div> <div> <div> <h3>Title</h3> Content </div> </div> </div> </div> |
In Chapter 3, we discussed changing our menu output to bulleted lists. You have three ways to control the details of your menu output. You can select Vertical, Horizontal, or Flat List. Vertical and Horizontal will use a table with tr
and td
cells to create vertical and horizontal lists. The Flat List will create an unordered (ul
) bulleted list. As the goal of most of today’s CSS is to reduce the use of tables and (as discussed in Chapter 4) there are infinite ways to control the display of an unordered list with CSS, the Flat List option is probably better.
Go to Modules | Site Modules and select mainmenu. You’ll then notice that you can select the menu’s style in the Joomla! Administration Panel. You can do this for all menus created with the Module Manager. Select Flat List, Horizontal, or Vertical from the Menu Style option.
While some of Joomla!’s output does include standard objects such as h1
, h2
, h3
, a
, p
, ul
, ol
, it is pretty much up to you to decide how to style these in your CSS. Below is a list of ids and classes generated by Joomla! (v1.0.x) for which you’ll want to be sure to create rules in your CSS. This list has been put together after a bit of research and a lot of Joomla! experimentation. It is probably not complete, but if you account for these items in your CSS rules, you’ll be pretty well covered for most Joomla! projects and it will be easy to spot any ids or classes not covered here and add them to your CSS sheet.
The following table gives a list of different ids along with their description:
Id |
Description |
---|---|
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
This is generated by the | |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
The following table gives a list of classes along with their description:
Class |
Description |
---|---|
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This class is generated by the |
|
This class is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This class is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
|
This is generated by the |
We’ve now looked at the standard XHTML Markup and CSS classes for Joomla! are and reviewed the standard ways to control what markup is produced via PHP and the Joomla! Administration Panel. Dog-ear this chapter and let’s get ready to start cooking. First up: Dynamic menus and interactive elements.