Joomla is a fantastic tool for building modern and dynamic... new to Joomla find it hard to set up their...

How to make a static home page in Joomla
Written by Marco Conti
Sunday, 04 February 2007 09:02
Joomla is a fantastic tool for building modern and dynamic websites. However, many people
new to Joomla find it hard to set up their site to mimic a non-portal site with one or more fixed
articles on the front or main home page. In this article I will try to explain some of the tricks you
can use to achieve this effect while keeping the RSS feed and the blog style layout of the
dynamic content.
In Joomla the "Home" page is not just a regular page. In fact, the "Frontpage", as it is called, is
nothing more than a Joomla component in its own right.
In a regular Joomla site the "Frontpage" allows the user to publish selected articles in a "blog"
or "portal" style. While this is a nice feature and one of the things that make Joomla so powerful,
many websites need a Home page with a fixed article to greet and guide visitors or illustrate the site purpose. While this is actually easy to achieve, it is not immediately evident. I will assume
you know your way around Joomla! by now, but even if you don't these techniques should be
fairly easy to follow.
This is possibly the easiest technique of all. Create a static content item and in your
administration area go to the "Menu Manager".
Choose "Main Menu", link the static content you created (or alternatively, make a link to it from
the content pane) and once
you are done move the link to the number 1 spot in the list of links of Main Menu.
In Joomla the topmost link in the Main Menu is the site's home page. Go back to the live site
and you'll see that your static article is your home page.
To keep your RSS feed (remember, in Joomla only the Frontpage has an RSS feed attached to
it) move the previously named "Home" link elsewhere. Because of its blog style appearance and
functionality you can move it to a link named "Blog" if you need a blog on the site with an RSS
feed and it will work just fine for that purpose.
{pgomakase}
What if you need a static, fixed article on your Home page but you want to retain the ability to
publish other articles on your home page in more of a "portal" style? In this case you'll need to
1/4
How to make a static home page in Joomla
Written by Marco Conti
Sunday, 04 February 2007 09:02
get your hands dirty a bit and follow this procedure:
{pgomakase}
- In your Modules > Site Modules create a new module.
- Name it what you want but a descriptive title will help.
- In this module you will see a bunch of fields that allow you to publish an RSS feed in a
module position.
- Ignore those and skip to the content pane at the bottom of the module interface.
- There you will be able to write your content as if it was a regular content item.
Before you save, go to the top of the interface and make sure you:
- Publish the module (select yes)
- Pick an unused Position such as user7, 8 or 9 (or any other non-named position - named
positions are fine if you don't use them in your site but I prefer numbered positions)
- Ignore module order. If this is the only module in this position it won't matter
- Go to the right pane and make sure you publish the module in the first link of the Main
Menu (usually "home")
- If needed (as we'll see later) apply a "Module Class Suffix" (something like "-homepage")
to allow you to style the module independently of the others if needed.
Wait, you are not done. Now you'll need to make a small change to your template.
- Go to your FTP program and download your index.php file from the template directory (not
the main Joomla index.php).
- In fact, you should already have at least the entire template directory for your site on your
hard drive.
- Next, in index.php look for the name of the div that contains your current content.
- You need to insert what is called a "module position" in the space above your content.
- To make this easy, search for this tag: <?php mosMainBody(); ?> (This is your main body
tag where your content should appear in your template. Above that you will see a number of
DIVs elements (or table tags if that's what you are using).
If you need help finding a good spot for your new module, do this:
- Go to your site
- Do a "view source"
2/4
How to make a static home page in Joomla
Written by Marco Conti
Sunday, 04 February 2007 09:02
- In Dreamweaver or other text editor, paste the source
- Identify the main content in your HTML and see where you could include a div or table
above it. Remember, now you are working with a good old static page here, so it should be
easy.
- Make a note of the tags used above your content and find the same tags in your index.php
file
- Insert this code where you would like your static content to appear: <?php (
mosCountModules('userx')?>
- X marks the user number you have specified when you created the new module.
- Upload the index.php file to the server - NOTE: Make a backup first!
- Go check if it works fine. If you need to style it you can now use the suffix you specified
earlier like this:
module-suffix {} (where "module" is the stock class used by a module and "-suffix" is what
you entered in the module panel)
Try also without the suffix if you want. Just remember you have the option.
Now, you should have your regular "Frontpage" working as usual but you'll also have a static
content item at the very top. If you need to display also other static content while still having the
dynamic "blog" style content, you can repeat the process by placing more modules in the same
position, placing another position anywhere on the page or placing modules with static content
in the side positions.
Just remember to publish the static content exclusively on the home page or every page will
have the same static content in it and remember that your static content is no longer in the
regular Joomla content structure and each time you need to update it you'll need to go to the
module manager.
There is also a contribution that substitutes the Frontpage component and does pretty much the
same thing on its own. It is called "MJ Frontpage" and it is available here http://extensions.joo
mla.org/component/option,com_mtree/task,viewlink/link_id,995/Itemid,35/
To install simply use the regular component installer and go to components > MJ Frontpage.
There you will find a content pane for your static content. All the features of the Frontpage
should be available but read the documentation to make sure.
3/4
How to make a static home page in Joomla
Written by Marco Conti
Sunday, 04 February 2007 09:02
This should be it's own article and I will only touch on it in passing. however, I would be remiss if
I didn't mention that in Joomla it's possible to customize the order in which your articles appear
in any kind of list, blog or even in the Frontpage.
To have an article permanently fixed in your Frontpage you need to make sure that you set up
the custom ordering of your Sections, Categories and single articles. This is trickier than it
sounds and as I said it merits it's own article, but if you know even just a bit of Joomla you
should be able to figure it out by going to the Category manager, Section Manager and content
manager, place the sections, categories and content in the order you prefer and make sure you
select the custom ordering in your Frontpage preferences ( Admin > top menu > Content >
Frontpage Manager).
The drawback of this system is that your RSS feed will also be affected by it and it will display in
the same order, making it appear at first glance as if it wasn't updated in a while.
I hope you found this article useful and feel free to let me know how I can improve it. Good luck
Marco Conti is the owner - webmaster of conticreative.com, a web agency specializing in Open
Source integration for e-commerce, CMS and SEO.
4/4