Written by Arno Zijlstra Wednesday, 18 March 2009 10:54
Ring, ring,
Arno: Hello, this is Arno speaking.
Jessica: Hi Arno this is Jessica and you need to help me out!
Arno: Hi Jess what's up, what can I help you with?
Jessica: Sander and me are selected to be one of the last 100 candidates for the Million Dollar Wedding TV show and we need a cool website fast to be able to promote ourselves …. and you are my man J
Arno: Ha, well thanks for the honor /Arno shakes head
Jessica: Can you get me a great website in the next couple of days? I know you are very busy but it's me here, your lovely niece…
Arno: Yeah, yeah, ok, I can do that but you need to add and manage the content yourself trough the Joomla! Content Management System.
Jessica: Great, I can do that … I hope, I need a domain too so let me know when I can start, need to go now creating a flyer, catch you later, you're the best I love you.
Sunday night, there I sat and my plate was full of work but what can you do in a situation like this. There is only one thing you can do … download Joomla! 1.5, fire up your localhost and get rocking.
The installer is running smoothly and within a few minutes I have the site without Joomla! default data up and running and ready for a new clean custom site and template. You could of course opt for a free template or a template from one of the many template clubs in a situation like this, but since building custom templates is my specialty and passion I always start my templates from scratch. I like things to be unique.
There are solid reasons for building a template from scratch to match the needs and goals a site or client has regarding branding or the markup. A site should be light weight, SEO effective and accessible. Free and template club templates are great but they are built to be used by many people and therefore in many cases include lots of functions, features and render lots of (x)HTML and CSS you may not even need for your website.
So, starting from scratch it is, and I will try to walk you through the process I take from start to finish in a fast and not too complicated way.
Before you can start building you need the minimum required files for a Joomla! template. I have a standard plain package that I can use over and over again and will offer a download link for the package at the end of this tutorial.
My package is called "joomla_base" and contains the following files and folders:
joomla_base/
HTML/
index.html
pagination.php
modules.php
CSS/
index.html
reset.css
pageframe.css
pagestyle.css
images/
index.html
logo.png
a few other images
index.html
index.php
templateDetails.xml
template_thumbnail.png
favicon.ico
Those are the basics you need for a Joomla! template; everything else like template parameters or overrides you'll find in some template packages is advanced stuff. Those are things you can play with after you understand the basics.
I code all my HTML and CSS by hand because I want full control over it, and don't trust WYSIWYG software, But if you don't have the knowledge to write HTML yourself these software packages will be something for you to use. Do take a look at the plain HTML from time to time so you can learn and understand what is happening under the hood.
Put the "joomla_base" folder in Joomla! the templates directory, you'll also find templates called "rhuk_milkyway" and "beez" in there.
Now you need to give your template a name, lets name it "my_template" for the rest of this tutorial.
The first thing you do is rename the template folder from "Joomla_base" to "my_template"
The second thing is opening the templateDetails.xml file and change this line:
<name>Joomla base</name> to <name>My template</name>, that way you can recognize the template in the Joomla! administrator template manager.
Login to your Joomla administrator and go to Extensions -> Template manager. In the list you will see your template, check the radio box and press the "Default" button in the Joomla! toolbar.
Your template is the active template now and you can have a look at the Joomla! front-end, there's not much there because you did an install without the Joomla! demo data, nice and clean just how we want it.
The "joomla_base" package has the following module positions:
Position "level1_menu" is there to create a horizontal main menu., Let's create that menu.
Position "level2_menu" is for submenu items and will be vertical, lets create that.
Position "content_top" is a position above the content area and "content_bottom" is a position below the content area, you can just publish modules there if you want or need too.
Position "sidebar_top" is a position above the "level2_menu" position and "sidebar_bottom" is a position below that menu, you can just publish modules there if you want or need too.
Position "footer" is a position at the bottom of the site and you can publish modules there if you want or need to and the same counts for copyright although that is styled by CSS to just hold a oneliner with a copyright text, that would be done with a "Custom HTML" type module.
Now once the above is done you are ready to start playing with your actual design.
The motto is, don't be afraid just try and find out!
I've put some CSS background images in the template, you can just replace them with your own beautiful images and see the site change with incredible speed.
In the file called "reset.css" there is CSS that you normally don't have to change. The CSS reset was created by web guru Eric Meyer at http://meyerweb.com and there are pro's and con's for using it, but I like it, so I use it. What it does is basically reset different interpretations of CSS that browsers begin with so that you have a known, blank start to work with.
The file called "pageframe.css" is the file that just holds the CSS for the frame of the site. This is the place where I set the header values, the position of the sidebar etc etc.
The file called "pagestyle.css" is where the candy goes, menu styles, module styles and everything that is really a site frame matter.
The reason I make such a separation is that by having the frame CSS in its own file I can very easily change the layout of the site, for example having the site-bar appear right instead of left.
The file called "index.php" is where the markup lives, just open it up in a text-editor and have a look at what is in there.
Here are some things you will find:
<?php defined('_JEXEC') or die('Restricted access'); ?>
<jdoc:include type="head" />
#header-container {
height: 200px;
background: url('/../images/header_back.png') 0 0 no-repeat;
}
.inner {
padding: 0 10px 10px 10px; /* no top padding */
}
<?php if($this->countModules('content_top')) : ?>
<jdoc:include type="modules" name="content_top" style="raw" />
<?php endif; ?>
That is in blazing speed explained what a Joomla! template is and I hope this gives you the basis to start building your own template from scratch using the "Joomla_base" template as a guideline.
The most important thing to remember is again "don't be afraid to try," you'll learn by trying and trying again.
Change and refresh the site front-end after a change and see what happens:
The index.php and CSS files are full of comments explaining what different parts do, you can remove them when you put a template on a real site.
The template uses none of the Joomla! core CSS classes or id's because right now it shows that basically any HTML/CSS design can be used as a Joomla! template.
Update on the wedding. They managed to stay in the game until there where just 4 couples left and than they lost. They're going to marry any way in the next couple of weeks :-)
This post on Joomla! is called Joomla! 1.5 and the Million Dollar Wedding
Arno Zijlstra is the creative mind and founder of alvaana.com development lab for the web. He is one of the original founders of the Joomla! Open Source Content Management System and has been involved in a couple of other Open Source projects. His passion is creating sites and interfaces that look different and are built with accessibility, usability and web-standards being truly important. Always on the look out for new things and open to learn from anyone, anytime.
Follow me at http://twitter.com/me_arno
More about Arno Zijlstra
We have a team that works on the blogs presented on this site. Below you will find all present members who are actively working on blogs on this site.
Please contact us if you are interested in helping us out with the creation of the blogs.
jfoobar has readers from all over the world and in many languages. If you create a translation of one of our posts and link to it than please let us know so we can add a link back to the translation at the original post.
Copyright © 2008 jfoobar - All Rights Reserved - Joomla! is a registered trademark of Open Source Matters, Inc - Disclaimer
Re: nice post!
# 1 - Posted by: Sam on 2009-04-20 23:43:26
this is a great post! i started using joomla about a year ago and was completely on my own. i read the joomla documentation over and over again just to wrap my head around what all of it meant. i even bought a joomla templating book. this post is great because it's easy to read for a beginner and really covers every bit of detail that you'd be concerned with in putting out a quick template. good job! i wish this was written a year ago.