Actions

Difference between revisions of "Upgrading a Joomla 1.5 template to Joomla 2.5"

From Joomla! Documentation

(Template parameters)
(Added references to versions after 1.6. Corrected punctuation and spelling.)
Line 1: Line 1:
 
{{RightTOC}}
 
{{RightTOC}}
This page provides feedback on the process of upgrading a Joomla 1.5 template for use with Joomla 1.6 from those who have already attempted it. This is intended to be a living document that can be added to as more experience is gained and is likely to be reorganised periodically. If you have encountered a problem when upgrading a template, or if you have any information that you think will help smooth the way for others who will follow then please add your comments initially on the Talk page. We will then collate the information and incorporate it into this page.
+
This page provides feedback on the process of upgrading or converting a Joomla 1.5 template for use with Joomla 1.6 and later versions from those who have already attempted it. This is intended to be a living document that can be added to as more experience is gained and is likely to be reorganised periodically. If you have encountered a problem when upgrading a template, or if you have any information that you think will help smooth the way for others who will follow then please add your comments initially on the Talk page. We will then collate the information and incorporate it into this page.
  
 
[[User:Chris Davenport|Chris Davenport]] prepared [http://www.slideshare.net/chrisdavenport/template-changes-for-joomla-16 slides for a presentation at the JoomlaDay UK 2010 event] which explain the changes in templates for Joomla! 1.6.
 
[[User:Chris Davenport|Chris Davenport]] prepared [http://www.slideshare.net/chrisdavenport/template-changes-for-joomla-16 slides for a presentation at the JoomlaDay UK 2010 event] which explain the changes in templates for Joomla! 1.6.
  
 
== Template parameters ==
 
== Template parameters ==
In both Joomla! 1.5 and 1.6 template parameters are defined in templateDetails.xml.  
+
In Joomla! 1.5, 1.6 and later versions, the template parameters are defined in templateDetails.xml.  
  
Whereas in 1.5 parameters are defined as part of the <code><params></code> section, and each parameter is defined as a <code><param></code>, in 1.6 template parameters are contained in the <code><config></code> section and treated as a <code><field></code> nested within the <code><fieldset></code> and <code><fields></code> tags, as illustrated below.
+
Whereas in 1.5 parameters are defined as part of the <code><params></code> section, and each parameter is defined as a <code><param></code>, in 1.6 and later template parameters are contained in the <code><config></code> section and treated as a <code><field></code> nested within the <code><fieldset></code> and <code><fields></code> tags, as illustrated below.
  
 
<pre>
 
<pre>
    <config>
+
<config>
        <fields name="params">
+
    <fields name="params">
            <fieldset name="basic">
+
        <fieldset name="basic">
                <field name="" type=" default="" label="" description="">
+
            <field name="" type=" default="" label="" description="">
                    <option value="1">On</option>
+
                <option value="1">On</option>
                    <option value="0">Off</option>
+
                <option value="0">Off</option>
                </field>
+
            </field>
                <field name="" type="" default="" label="e" description="" />
+
            <field name="" type="" default="" label="e" description="" />
            </fieldset>
+
        </fieldset>
        </fields>
+
    </fields>
    </config>
+
</config>
 
</pre>
 
</pre>
  
<code><fieldset name="basic"></code> wraps the parameters in a slider and using name="basic" labels that slider as "Basic Options" and name="advanced" labels it as "Advanced Options".
+
<code><fieldset name="basic"></code> wraps the parameters in a slider. Using ''name="basic"'' labels that slider as "Basic Options" and ''name="advanced"'' labels it as "Advanced Options".
  
The name="" type="" default="" label="" description="" attributes still apply.
+
The ''name'', ''type'', ''default'', ''label'' and ''description'' attributes still apply.
  
 
== Template Manifest File ==
 
== Template Manifest File ==
Two other important changes to the templateDetails.xml file include: 1) adding the new 1.6 Doctype
+
Two other important changes to the templateDetails.xml file include:
and 2) changing the <install> tag to <extension> as shown below.
+
# adding the new 1.6 Doctype
 +
# changing the <install> tag to <extension> as shown below.
 
<pre>
 
<pre>
 
<?xml version="1.0" encoding="utf-8"?>
 
<?xml version="1.0" encoding="utf-8"?>
Line 35: Line 36:
 
<extension version="1.7" type="template" client="site">
 
<extension version="1.7" type="template" client="site">
 
</pre>
 
</pre>
Notice the additional new "client" attribute which is set to "site" for a front-facing template and "administrator" for an back-end template.
+
Notice the additional new ''client'' attribute which is set to ''site'' for a front-facing template and ''administrator'' for an back-end template.
  
 
== Objects and Methods ==
 
== Objects and Methods ==
 
=== Sitename ===
 
=== Sitename ===
 
 
* <code><?php echo $mainframe->getCfg('sitename');?></code> is now <code>$app->getCfg('sitename');</code> Where <code>$app = JFactory::getApplication();</code>
 
* <code><?php echo $mainframe->getCfg('sitename');?></code> is now <code>$app->getCfg('sitename');</code> Where <code>$app = JFactory::getApplication();</code>
  
Line 48: Line 48:
 
== Layout Overrides ==
 
== Layout Overrides ==
 
=== com_content ===
 
=== com_content ===
If you have used the Beez overrides, or code derived from the Beez overrides, in your 1.5 template then you may encounter a "JHtml: :icon not supported. File not found." error when migrating the template to Joomla 1.6 or later. To fix this, simple add the following statement near the top of the template html/com_content/article/default.php file:
+
If you have used the Beez overrides, or code derived from the Beez overrides, in your 1.5 template, you may encounter a ''JHtml::icon not supported. File not found.'' error when migrating the template to Joomla 1.6 and later. To fix this, simply add the following statement near the top of the template html/com_content/article/default.php file:
 
<source lang="php">
 
<source lang="php">
 
JHtml::addIncludePath( JPATH_COMPONENT . '/helpers' );
 
JHtml::addIncludePath( JPATH_COMPONENT . '/helpers' );

Revision as of 17:30, 19 February 2012

Contents

This page provides feedback on the process of upgrading or converting a Joomla 1.5 template for use with Joomla 1.6 and later versions from those who have already attempted it. This is intended to be a living document that can be added to as more experience is gained and is likely to be reorganised periodically. If you have encountered a problem when upgrading a template, or if you have any information that you think will help smooth the way for others who will follow then please add your comments initially on the Talk page. We will then collate the information and incorporate it into this page.

Chris Davenport prepared slides for a presentation at the JoomlaDay UK 2010 event which explain the changes in templates for Joomla! 1.6.

Template parameters

In Joomla! 1.5, 1.6 and later versions, the template parameters are defined in templateDetails.xml.

Whereas in 1.5 parameters are defined as part of the <params> section, and each parameter is defined as a <param>, in 1.6 and later template parameters are contained in the <config> section and treated as a <field> nested within the <fieldset> and <fields> tags, as illustrated below.

<config>
    <fields name="params">
        <fieldset name="basic">
            <field name="" type=" default="" label="" description="">
                <option value="1">On</option>
                <option value="0">Off</option>
            </field>
            <field name="" type="" default="" label="e" description="" />
        </fieldset>
    </fields>
</config>

<fieldset name="basic"> wraps the parameters in a slider. Using name="basic" labels that slider as "Basic Options" and name="advanced" labels it as "Advanced Options".

The name, type, default, label and description attributes still apply.

Template Manifest File

Two other important changes to the templateDetails.xml file include:

  1. adding the new 1.6 Doctype
  2. changing the <install> tag to <extension> as shown below.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE install PUBLIC "-//Joomla! 1.6//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/1.6/template-install.dtd">
<extension version="1.7" type="template" client="site">

Notice the additional new client attribute which is set to site for a front-facing template and administrator for an back-end template.

Objects and Methods

Sitename

  • <?php echo $mainframe->getCfg('sitename');?> is now $app->getCfg('sitename'); Where $app = JFactory::getApplication();

Error Codes

  • $this->error->code is replaced by $this->error->getCode();
  • $this->error->message is replaced by $this->error->getMessage();

Layout Overrides

com_content

If you have used the Beez overrides, or code derived from the Beez overrides, in your 1.5 template, you may encounter a JHtml::icon not supported. File not found. error when migrating the template to Joomla 1.6 and later. To fix this, simply add the following statement near the top of the template html/com_content/article/default.php file:

JHtml::addIncludePath( JPATH_COMPONENT . '/helpers' );