articles

Home / DeveloperSection / Articles / How to create custom template in Joomla

How to create custom template in Joomla

Anonymous User9620 05-Mar-2012

Joomla provides many default templates to apply in your website, but if you want to create your own template, you have to follow these two steps.

1.       Create your own templates file

2.       Upload zip file of template file

Step1: Create your template file:

To create your template file, first of all you have to create two file: ‘index.php’ and ‘templateDetails.xml’.

‘index.php’ File: 

‘index.php’ files are those file where the entire markup goes in which you stick the Joomla includes. These can be seen as little hooks where joomla hangs up information on, like modules for example.

‘templateDetails.xml’:

‘templateDetails.xml’ files are those file where you can see template details as a list of instructions to Joomla. This list must include the name of the template, the names of the files used in the template (images etc.) and the positions you want to use in your website.

Now let’s take a look on these two file that how it’s created through the code.

‘index.php’ code:
 <!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="component" /> 
<jdoc:include type="modules" name="left" /> 
<jdoc:include type="modules" name="footer" /> 
</body> 
</html> 

‘templateDetails.xml’ Code:
<?xml version="1.0" encoding="utf-8"?> 
<!DOCTYPE install PUBLIC "-//Joomla! 1.7//DTD template 1.0//EN" "http://dev.joomla.org/xml/1.5/template-install.dtd"> 
<install version="1.7" type="template"> 
       <name>MyTemplate</name> 
       <creationDate>26-01-2012</creationDate> 
       <author>Arun Kumar Singh</author> 
        <authorEmail>myusername@domain.com</authorEmail> 
        <authorUrl>http://mindstick.com</authorUrl> 
        <copyright>mindstick 2010</copyright> 
        <license>GNU/GPL</license> 
        <version>1.0.0</version> 
        <description>My Template</description> 
        <files> 
                <filename>index.php</filename> 
                <filename>templateDetails.xml</filename> 
               
         </files>        
 
        <positions> 
                <position>breadcrumb</position> 
                <position>left</position> 
                <position>right</position> 
                <position>top</position> 
               <position>user1</position> 
                <position>user2</position> 
                <position>user3</position> 
                <position>user4</position> 
                <position>footer</position> 
        </positions> 
</install> 

 

Now save these files into a directory, here I am taking a temporary directory ‘MyTemplate’ within which I have store these files and make its zip file.

Step 2:  Upload zip file of template file

To upload this file in joomla, first of all login in Joomla Administrator Panel and go to Extensions -> Extension Manager.

How to create custom template in Joomla

Now click on ‘Browse’ button and then click on ‘Upload & Install’.

How to create custom template in Joomla

How to create custom template in Joomla

Now go to Extensions -> Template Manager, select your template name from template list and set it default by clicking ‘Make Default’ button.

How to create custom template in Joomla

To see the output click on ‘View Site’ link this is at top right corner of panel.

How to create custom template in Joomla



Updated 07-Sep-2019
I am a content writter !

Leave Comment

Comments

Liked By