If you recall in my last post we discussed how Gantry was basically a grid system which alllows you to position content throughout your site without having to know any CSS. Take a look at the close up of your ganrty system below (special thanks to Steven Cohen for reminding me of Greenshot for taking screen shots).
In the screen shot above you will notice the main content area of your site. The Mainbody position is the default area where the Joomla! article is published. You will also recognize your main sidebar positions and your content-top and bottom positions. Thanks to Gantry this entire section of your template can be turned off with the flip of the switch, all that we need to do is take some simple steps to create a new template and assign it to a menu item.
The first step is to create a new template. Go to your template manager and open your template. You will see something similar to the screen below:
Go ahead and create a new template by duplicating your master sheet. Rename that template something that makes sense like “no-body”. When you click through the options of your new template you will notice that all the options are grayed out. This is because what you have created is a template override and only the settings which you check off will be active. These checked off items will override the default master. Now, click on the “advanced” option. You will notice two settings available to you for controling how the tempalte displays the mainbody of your site. The first is “Display Component” and the second is “Mainbody Enabled”. The Display Component will turn off the article position but leave the surronding content-top, bottom and sidebar positions intact. The Mainbody Enabled will turn off both the article and it’s surrounding module positions.
Choose the setting you want to use. For this tutorial I will be disabling the entire mainbody. Save and close your template settings.
Now let’s create a new menu item that uses this template. Open up your menu manager and create a new menu item as you always do. For your menu item type you are going to choose “featured articles”. Also you will need to change the template for this particular menu item to the override template you just created. You will see how to do this in the second screen shot below using the dropdown options for “template style”.
In the screen shot above you will notice that we are choosing the no body override template which we created in the previous step. The combination of the featured article menu item type and the override template settings will now alllow you to publish this menu item without requiring an article.
You can use your imagination and be creative when setting up your template in this way. I like to use this option because it gives us greater control over the layout of the site, it also allows us to set up slideshows and animations using modules instead of trying to embed a module in an article, or utilzing some clunky JavaScript. Modules as you are probably coming to realize are much more powerful than just a simple article so why not use them to thier full potential? Here is an example of a site I am currently building for an Environmental Services company which makes use of the “no body” layout for every page. If an area of custom content or text was required, a custom HTML module was used instead of an article.
All of this is not to say that the Joomla! article should be abandoned, it is definitely an essential tool in the Joomla! tool box and indespensible for setting up archives and categories, however in many cases getting a good clean layout for your content is much easier to accomplish through a module only page. Such a page offers you a greater deal of percision when placing content on your site and hopefully a better user experience for your constituents.
I hope you are finding these articles helpful or at least reconfirming some things you already know about Gantry. In my next post I plan to tackle the Module Suffix and show you how to gain better control over your site styling, fonts and colors using some simple CSS. So get your coding suits on and be prepared to do a little diving into the code, I promise it won’t hurt!
Stay Tuned!