Archived

Difference between revisions of "Adapting a Joomla 1.5 extension to Joomla 2.5"

From Joomla! Documentation

Line 20: Line 20:
 
#Remove any illegal strings that can prevent files loading. Find ^(null|yes|no|true|false|on|off|none)=(.+)\R and replace with nothing.
 
#Remove any illegal strings that can prevent files loading. Find ^(null|yes|no|true|false|on|off|none)=(.+)\R and replace with nothing.
  
The now "illegal" strings in the language file like NO, are now handled by adding a 'J' in-front of them. You can include in your language file:
+
If you do not remove these illegal strings, then your language file won't load and you won't get any error message. The now "illegal" strings in the language file like NO, are now handled by adding a 'J' in-front of them.  Just make sure you change these language strings in your XML files as well. You can include in your language file:
 
<pre>
 
<pre>
 
;forbidden words
 
;forbidden words
Line 33: Line 33:
 
</pre>
 
</pre>
  
 +
== Change in method on how to override javascript functions==
 +
Joomla now has its jabascript functions with Joomla. this means the functions are always unique and won't clash with other javascript function on your server/webpage. However you now need a different method to override the default joomla javascript. The Joomla 1.5 method was:
 +
<pre>
 +
function submitbutton(pressbutton) {
 +
var form = document.adminForm;
 +
    if (pressbutton == 'applyconfig') {
 +
        //do something unique
 +
        form.action.value = 'apply'
 +
        submitform('saveconfig');
 +
        return;
 +
    }
  
 +
    submitform(pressbutton);
 +
    return;
 +
}
 +
</pre>
 +
for joomla 1.6 you need to copy your exisiting function but modify your top line to:
 +
<pre>
 +
Joomla.submitbutton = function(pressbutton) {
 +
var form = document.adminForm;
 +
    if (pressbutton == 'applyconfig') {
 +
        //do something unique
 +
        form.action.value = 'apply'
 +
        submitform('saveconfig');
 +
        return;
 +
    }
 +
 +
    submitform(pressbutton);
 +
    return;
 +
}
 +
</pre>
  
  
  
 
[[Category:Joomla! 1.6]]
 
[[Category:Joomla! 1.6]]

Revision as of 02:52, 7 December 2010

This page has been archived. This page contains information for an unsupported Joomla! version or is no longer relevant. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Quill icon.png
Content is Incomplete

This article or section is incomplete, which means it may be lacking information. You are welcome to assist in its completion by editing it as well. If this article or section has not been edited in several days, please consider helping complete the content.
This article was last edited by Mariusvr (talk| contribs) 13 years ago. (Purge)


This article is written to help developers upgrade their extensions from Joomla 1.5 to Joomla 1.6. If you have any further tips, feel free to add them onto this wiki article.

System setup[edit]

This document assumes that you are running the program eclipse for your development. This will allow you to automate most of the Joomla conversion process. For more instructions on how to setup eclipse visit: http://docs.joomla.org/Setting_up_your_workstation_for_Joomla!_development

Background reading[edit]

The following article describes most changes of Joomla 1.6 and how this affect developers. http://docs.joomla.org/What%27s_new_in_Joomla_1.6#Developers

Updating your Joomla 1.5 language files to work on Joomla 1.6[edit]

Using the native php ini parser for language files has many benefits including much faster performace. Converting your exisiting Joomla 1.5 into the new format is very easy if you use a coding platform like eclipse. Search your file for *.ini in your project of choice. Then use the following search/replace values to automatically, replace exisiting quotes, add quotes to string values and update your comments

  1. Double quotes are now not allowed and this can be easily bypassed by searching " and replace with '
  2. Put a closing double quote at end of line if not empty or a comment. Find ^((?!#).+)\R replace with $1"\R
  3. Put an opening quote at start of translated string if not empty or comment. Find ^((?!#).+?\=)(.+)\R replace with $1"$2\R
  4. Now replace the hash comments with the new semi colon. Find ^# and replace with ;
  5. Remove any illegal strings that can prevent files loading. Find ^(null|yes|no|true|false|on|off|none)=(.+)\R and replace with nothing.

If you do not remove these illegal strings, then your language file won't load and you won't get any error message. The now "illegal" strings in the language file like NO, are now handled by adding a 'J' in-front of them. Just make sure you change these language strings in your XML files as well. You can include in your language file:

;forbidden words
JNULL="Null"
JYES="Yes"
JNO="No"
JTRUE="True"
JFALSE="False"
JON="On"
JOFF="Off"
JNONE="None"

Change in method on how to override javascript functions[edit]

Joomla now has its jabascript functions with Joomla. this means the functions are always unique and won't clash with other javascript function on your server/webpage. However you now need a different method to override the default joomla javascript. The Joomla 1.5 method was:

function submitbutton(pressbutton) {
var form = document.adminForm;
    if (pressbutton == 'applyconfig') {
        //do something unique
        form.action.value = 'apply'
        submitform('saveconfig');
        return;
    }

    submitform(pressbutton);
    return;
}
for joomla 1.6 you need to copy your exisiting function but modify your top line to:
Joomla.submitbutton = function(pressbutton) {
var form = document.adminForm;
    if (pressbutton == 'applyconfig') {
        //do something unique
        form.action.value = 'apply'
        submitform('saveconfig');
        return;
    }

    submitform(pressbutton);
    return;
}