How to upgrade a Joomla 1.5 module to Joomla 1.6

How to upgrade a Joomla 1.5 module to Joomla 1.6 

If you need to upgrade modules you are currently using with Joomla 1.5 to Joomla 1.6, this is not as difficult as it sounds. The following are the basic steps need to upgrade a module from Joomla 1.5 to Joomla 1.6


Step 1. - Language Files

As stated in the specifications language files should have UTF-8 character encoding and may not contain any of the following names as 'key' (ini files are structured like KEY="value"):

  • NULL
  • YES
  • NO
  • TRUE
  • FALSE
  • ON
  • OFF
  • NONE

If you do use one of these words as key, your language file won't be translated by Joomla, without any error message shown to alert you of that. To prevent this, prefix the keys above with a character, such as 'J'. Some example keys that are prefixed would be: JYES, JNO, JNULL, etc. Both spaces and the following characters are also prohibited in keys: { } | & ~ ! [ ( ) ^ "

Another change in language files is that in Joomla 1.6 you should use double quotes around values. Below an example:
COPYRIGHT_LABEL="Show copyright"

instead of the Joomla 1.5 way
COPYRIGHT_LABEL=Show copyright

 

Step 2. - Double quotes in Joomla 1.6 languages files

But what if you want to use a double quote in your language string? According to the specifications you need to use two double quotes, but testing that showed me this doesn't work. What does work though, is using "_QQ_" as a double quote. PHP will replace that value with a double quote. 
COPYRIGHT_LABEL="Let's "_QQ_"quote"_QQ_" something!"

Shows the following language string:
Let's "quote" something!

The reason why you should use "_QQ_" is that PHP's ini file parser (parse_ini_string and parse_ini_file) seems to behave differently since PHP version 5.3.1. Using "_QQ_" you make sure everybody sees the language string correctly.

 

Step 3. - Comments in Joomla 1.6 language files

Furthermore, comments in language files are now prefixed with a semi-colon (;) instead of the pound sign (#) used in Joomla 1.5:
;COMMENT_LABEL="Comment this line out in Joomla 1.6"

instead of the old
#COMMENT_LABEL=Comment this line out in Joomla 1.5

 

Step 4. - The XML file

There are also several changes to the XML file that is packaged with your module (for example mod_breadcrumbs.xml).

Change:
<install type="module" version="1.5.0">
To:
<extension type="module" version="1.6.0" client="site" method="upgrade">

Also change the matching closing tag '</install>' to '</extension>'

The <params> section is replaced by a <config> section.

Change:
<params>
<param name="testSetting" type="text" default="something" label="Test" description="Test" />
</params>

To:
<config>
<fields name="params">
<fieldset name="basic">
<field name="testSetting" type="text" default="something" label="Test" description="Test" />
</fieldset>
</fields>
</config>

If you have custom fields, set the path to your custom fields in the <fields> tag, as shown below:

Change:
<params addpath="/modules/your_module_dir/elements">
To:
<fields name="params" addfieldpath="/modules/your_module/elements">

Furthermore, you no longer should extend JElement if you used to do that in your module, but instead you should now extend JFormField. See this document for detailed information about that.

 

Final Step - Your own module files

After applying the described steps, try to install your module in Joomla 1.6. With the above changes in place, the installation should probably work now. Depending on the complexity of your module however, you might need to do some additional changes to your own module files. These changes could include:

  • Getting rid of old PHP4 code as Joomla 1.6 requires PHP 5.2+
  • Change queries run on your database
  • Remove /stories from your default images folder
  • Upgrade code to work make it work with the different MooTools libraries that Joomla offers (1.12, 1.2 and 1.3) or make your life easier and just switch to jQuery instead.

One more thing...

Do you have friends or a Facebook group who you think would find this useful? Share this with them and then let me know what they think.

Want to supercharge your website?

  Our website loads FAST ... just 1.29 seconds. We're hosted on FAST InMotion servers We want YOUR website to be fast too, so we've gotten you an exclusive deal - 47% OFF for DART Creations friends + FREE domain! Check it out NOW!

Translate

who are we?

DART Creations is run by David Attard - working in and around the web design niche for more than 12 years, we provide actionable tips for people who work with and on websites.

David attard

Follow us on Social

         

 

 

 

Popular Content

Joomla extensions to take your website to the NEXT level

Is your Joomla website reaching its full potential? We install many of these extensions on almost ALL of our Joomla sites - why don't you check them out our list of Joomla Extensions and see whether you can take your site to the next level?

Where are we hosted?

This site is proudly powered by FAST VPS InMotion Servers and given an insane speed thanks to MaxCDN!

Web Hosting MaxCDN - Speed up your website

 

InMotion Hosting Review - Recommended Web Hosting servers for business, Joomla, WordPress and ecommerce websites.

InMotion Hosting Review

Advertise on DART-Creations.com

DART Creations is interested in developing partnerships with mutual benefit. If you like the stuff we publish and would like to develop a relationship, we'd be happy to hear from you. Go on - drop us a line - we'd love to hear from you :-)

The SUMMER DESIGN Bundle

26 premiums fonts, 22 graphic packs for$29. Get it NOW - July Only!

July bundle

New! DIVI 2.7 WordPress TeMPLATE + PageBuilder

You'll surely create a perfect website with Divi 2.7!

Divi WordPress Theme