How to convert Joomla 1.5 template to Joomla 2.5 template
In this tutorial, we will show how to convert a Joomla 1.5 template to Joomla 2.5 template. We will take default Joomla 1.5 template "rhuk_milkyway" as an example and convert it to Joomla 2.5 native compatible template.
Note:
This tutorial covers only the template conversion process, so it's assumed that you already have a Joomla 2.5 website installed, or converted from version 1.5.
There are 5 steps involved.
- Make a copy of all Joomla 1.5 template files
- Edit files structure
- Edit file "templateDetails.xml"
- Edit file "index.php"
- Install and test the converted Joomla 2.5 template
Step 1. Make a copy all Joomla 1.5 template files
The first thing to do is to copy the whole theme folder from version 1.5 to version 2.5
Copy the whole template folder
- Go to the theme folder in Joomla 2.5 website
- Create a folder named "rhuk_milkyway25"
- Copy all files from folder "rhuk_milkyway" in Joomla 1.5 template folder to folder created in point 2.
Step 2. Edit files structure
Now, you need to edit the folder structure to make it compatible with Joomla 2.5
Edit folder structure to make it compatible
- Delete file "params.ini"
- Copy file "error.php" from default Joomla 2.5 template "atomic"
- Create new file "template_preview.png"
In version 1.5 this file used to store values of template parameters. But in version 2.5, all template parameters are stored in the database. So there is no need for file "params.ini".
Joomla 2.5 introduces new file "error.php" to contain layout of error pages. This file is simple and we can reuse the file from default theme "atomic".
Joomla 2.5 introduces new file "template_preview.png" to present a big preview image of the theme. You need to make a 640x480 screenshot of your theme and name it "template_preview.png".
Step 3. Edit file "templateDetails.xml"
Now, you need to edit file "templateDetails.xml" to make it compatible with version 2.5.
- Rename tag <install> to <extension>
Old value |
New value |
<install version="1.5"... |
<extension version="2.5"... |
</install> |
</extension> |
- Change template name in tag <name>
- Replace multiple tags <filename> with single tag <folder>
This is very cool feature of Joomla 2.5. Now you don't need to declare all the files in some folder, you just need to declare that folder.
- Delete declaration for file "params.ini"
- Add declaration for new files created in step 2
- <filename>error.php</filename>
- <filename>template_preview.png</filename>
Add 2 following tags:
- Rename tags in section <params>
Old value |
New value |
<params> |
<config> |
<param... |
< field... |
</param> |
</ field> |
</params> |
</fieldset> |
Step 4. Edit file "index.php"
After editing file "templateDetails.xml", you need to continue to edit file "index.php".
- Add PHP code to load Mootool library
Add code string "JHtml::_('behavior.framework', true);" to the location as seen on the screenshot bellow.
- Replace template name text "rhuk_milkyway" with php code
Joomla 2.5 allows you to get the theme name directly from file "templateDetails.xml" file, so there is no need to declare the theme name as plain text.
Old Value |
New value |
rhuk_milkyway |
<?php echo $this->template ?> |
Step 5. Install and test converted Joomla 2.5 template
Now, the converted Joomla 2.5 template is presented in templates folder, but you won't see new theme in Template Manager, because it's not installed yet. Make following steps:
- Go to Administrator > Extensions > Extension Manager > Discover.
- Click button "Discover" on toolbar
Select the item "rhuk_milkyway25" in the list and click button "Install"
- Now, the Joomla 2.5 template is installed and you can go to "Template Manager" to set it as default.
We finished the Joomla template migration with template "rhuk_milkyway" for today. Do you have any other ways to convert your template from version 1.5 to version 2.5 ? Please share using comment form belows. Feel free to leave questions if you get trouble with this migration process.
Some articles published on the Joomla Community Magazine represent the personal opinion or experience of the Author on the specific topic and might not be aligned to the official position of the Joomla Project
By accepting you will be accessing a service provided by a third-party external to https://magazine.joomla.org/
Comments