Skip to main content

Joomla Designs

Templates in Joomla


Joomla templates consists of a frontend (the website) and a backend (the administration interface). Both parts have their own templates. They are stored in the folders
  • /templates - Frontend
  • /administrator/templates - Backend
Each template has it’s own folder. In Joomla 2.5 you’ll find two preinstalled non responsive templates (Beez 2 and 5) and one template framework (Atomic)
  • /templates/atomic
    Atomic a kind of an uncommon template framework
  • /templates/beez_20
    Beez 2 is the Joomla standard template.
  • /templates/beez5
    Beez 5 is the HTML5 version of Beez 2
  • /templates/system
    In this folder Joomla stores all the files that are common for all the templates, e.g. the Offline and the Error page.
The administrator folder looks the same
  • /administrator/templates/bluestork
    Bluestork is the default standard administrator template
  • /administrator/templates/hathor
    Hathor is an optional administrator template. It is accessible and colours are customizable.
  • /administrator/templates/system
    In this folder Joomla stores all the files that are common for all the templates, e.g. the Error page.

How to create a new Template?

You have three options for creating a new template
  1. start from scratch with creating a folder and all the necessary files
  2. install a starter theme and modify it
  3. copy an existing template and modify it
In this chapter we want to try option one. We’ll create a responsive frontend template based on the Twitter Bootstrap framework for Joomla 2.5 from scratch. I’ll keep it as simple as possibible. The aim of this chapter is to understand Joomla’s template structure. It’s quite easy to make it more and more pretty and complicate afterwards :)

Template name

First of all we need a name for our template. The name will appear in XML files, the database, the webservers files system and several caches. Avoid special characters and blanks in the name. I’ll call the template cocoate.

Files and Folders

Create a /templates/cocoate folder.
In the folder we need the following files and a subfolder css
  • /templates/cocoate/index.php
  • /templates/cocoate/templateDetails.xml
index.php
<?php
defined('_JEXEC') or die;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<jdoc:include type="head" />
</head>
<body >
<jdoc:include type="modules" name="top" style="xhtml" />    
<jdoc:include type="modules" name="breadcrumbs" style="xhtml" />
<jdoc:include type="modules" name="left" style="xhtml" />
<jdoc:include type="component" />
<jdoc:include type="modules" name="right" style="xhtml" />
<jdoc:include type="modules" name="footer" style="none" />    
</body>
</html>
Listing 1: index.php
The index.php file is the “page” template, the “big picture”. Inside this file all the bits and pieces (CSS, JavaScript, Joomla content) were loaded. In our example I just loaded the Joomla content with the <jdoc:include …> command. It contains the head, the component content and the module content depending on the postion of the module (What is a module?).
templateDetails.xml
This is the most important file in a template. It is the manifest, or packing list file that includes a list of all the files or folders that are part of the template. It also includes information such as the author and copyright. Without this file, Joomla wil not find your template. The positions are the module positions that are already mentioned in the index.php file. You can create as many positions as you want. So far, there is no naming standard in Joomla.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE install PUBLIC "-//Joomla! 1.6//DTD template 1.0//EN" "https://www.joomla.org/xml/dtd/1.6/template-install.dtd">
<install version="2.5" type="template" method="upgrade">
    <name>cocoate</name>
        <creationDate>2012-07-17</creationDate>
    <author>Hagen Graf</author>
    <authorEmail>hagen@</authorEmail>
    <authorUrl>http://cocoate.com</authorUrl>
    <copyright>Copyright (C) 2012 cocoate</copyright>
    <version>1.0</version>
    <description><![CDATA[
    <p>cocoate is a template exercise from scratch.<p>
    ]]></description>
    <files>
        <filename>index.php</filename>
        <filename>templateDetails.xml</filename>
        <folder>css</folder>
    </files>
    <positions>
        <position>top</position>
        <position>breadcrumbs</position>
        <position>footer</position>
        <position>left</position>
        <position>right</position>
        <position>footer</position>
    </positions>
</install>

Comments

Popular posts from this blog

Joomla Shop Templates

Looking for Joomla shop templates for Virtuemart or J2store ? We have a wide collection of the best shopping cart templates for Joomla which are great for build a professional store and selling products online. https://www.themesmarketplace.net/product-category/joomla-templates/

New Responsive Joomla templates

We have added some new responsive Joomla templates to the themes marketplace which are great for building a mobile friendly website for your business. To view all the new templates we have for the latest version of Joomla! visit us today https://themesmarketplace.net/product-category/joomla-templates/

Best Joomla E-commerce Templates

Joomla is a great content management system for opening a shop for your business. Joomla offers two free open source e-commerce extensions which are used by thousands of websites around the world to sell products online. The two shopping cart extensions in question are called Virtuemart and J2store Both shopping cart extensions for Joomla come with everything you need to open a shop plus they seamlessly fit with Joomla so you can easily combine products with the content you create at your website. At the themes marketplace website we have the best Joomla ecommerce templates available for download on the internet. Each Joomla ecommerce template designed at the themes marketplace comes with everything you need to quickly and easily setup a professional store to help you sell products on the internet. To view all the Joomla shopping cart templates at the visit https://themesmarketplace.net/product-category/joomla-templates/