This article started off as a Blog entry but as things have been discovered it was decided to make it a full article.  It describes the changes that have been made to our extensions as a result of enabling them to run under Joomla 3.0.  When we are satisfied that the extensions are fully tested we will release updates to the wider community. Some of the changes required were the result of features deprecated in earlier versions which only now have started to bite.

Sections

Joomla 3.1 Observations
Joomla 3.2
Supporting Joomla 2.5 and 3.x in one component.

General

There is a document listing backward compatibility issues with Joomla 2.5 and the Joomla Platform 12.1. Also this link.

Description of 12.1 MVC framework is here.

Some of the following changes have been identified in the document referred to above, but others are the result of our own testing. So far we have discovered (and made the following changes):

1. In the Joomla! 3.0.0 version get an installation error that shows Directory separator constant DS error. Solution is to add the following code:


if(!defined('DS')){
define('DS',DIRECTORY_SEPARATOR);
}

This is still present in the full release as well.  This code has been added to all of the files where required.

2. Seems that JController::getInstance is no longer around. Need to use JControllerLegacy instead.

The old JController, JModel and JView classes have been renamed to JControllerLegacy etc.

The ‘new’ JController,JView, JModel are now classes in the new MVC implementation.

The solution is to use the legacy classes.

The following code does work:

$jversion = new JVersion();
if( version_compare( $jversion->getShortVersion(), '2.5.6', 'lt' ) ) {
$controller = JController::getInstance('IssueTracker');
else {
$controller = JControllerLegacy::getInstance('IssueTracker');
}

However there are numerous places particularly with class definition where we refer to JController, JView and JModel where such a construct will not work which will all require changing.

So in the situation of a moving 2.5 extension to 3.0, we have to

    1. modify JController::getInstance to JControllerLegacy::getInstance in master component file.
    2. modify extends JController to JControllerLegacy in master/default controller.
    3. modify extends JView to JViewLegacy in all view classes.

In the general case, we have to change JController to JControllerLegacy, JModel to JModelLegacy and JView to JViewLegacy. [We have only found once instamce where the change to JModel has been required.]

3. JHtmlBehavior::mootools not found.

Use JHtmlBehavior::framework instead.

This includes constructs such as : JHTML::_('behavior.mootools'); which becomes: JHTML::_('behavior.framework');

4. A few database class routines have changed.

Instead of $db->nameQuote we have to use $db->quoteName

and instead of $db->getEscaped we use $db->escape

Also JDatabase::loadResultArray() has been removed. Use JDatabase::loadColumn() instead.

5. The library routine jgrid has moved its directory. It was formally in libraries/joomla/html/html/jgrid.php

It is now located in libraries/joomla/html/jgrid.php.

Update for 3.1.x, seems it has moved yet again, now located in libraries/cms/html/jgrid.php

6. Our templates do not display nicely in the Isis template with a lot of items overlapping. Thus there is a need to rework our displays. [See section below on handling both templates.] Hathor template looks OK (as far as it goes!) Seems that the adminlist class has been replaced with the table class (from code inspection). Also the 'btn-group' class has replaced classes such as filter-select, and there are pull-right and pull-left classes as well instead of fltlft and fltrgt.

Note: A number of these changes are related to the change to use BootStrap templates.

These changes have been handled by extending our use of the css definitions file, introducing our own table class.  [Note that we have also introduced colour coding for priority and these are handled in the css classes as well.]

7. JDate::toMysql() has been removed. Use JDate::toSql() instead.

Change: $get_date= JFactory::getDate();

$date=$get_date->toMysql();

To: $get_date=JFactory::getDate();

$date=$get_date->toSql();

8. JUtility::sendMail() has been removed. Use JMail::sendMail() instead.

9. JUtility::sendAdminMail() has been removed. Use JMail::sendAdminMail() instead.

10. JDatabase::query() is deprecated, use JDatabaseDriver::execute() instead.

Change: $db->query();

To: $db->execute();

11. JFile::read is deprecated. Use native file_get_contents() syntax.

Change: $textfile= JFile::read(JPATH_COMPONENT . DS . 'text.txt');

To: $textfile=file_get_contents(JPATH_COMPONENT.DS.'text.txt');

12. JRequest is deprecated. Use JFactory::getApplication()->input

See: http://docs.joomla.org/Retrieving_request_data_using_JInput

Change: $post=JRequest::get('post');

JRequest::getVar('badwords');

To: $input =JFactory::getApplication()->input;

$post=$input->post;

$input->post->get('badwords')

Change: $task= JRequest::getVar('task');

To: $task=$input->get('task');

Change: $groupid= JRequest::getVar('id');

To: $groupid=$input->get('id');

Change: $limitstart=JRequest::getVar('limitstart', 0, '', 'int');

To: $limitstart=$input<->get('limitstart','0','INT');

Change: $controller=JRequest::getWord('controller');

To: $controller=$input->get('controller');

Change: $controller->execute(JRequest::getCmd('action'));

To: $controller->execute($input->get('action'));

13. JViewLegacy::assignRef is deprecated. Use native PHP syntax.

Change:  $this->assignRef( 'userlist', $userlist);

To:  $this->userlist=$userlist

14. JParameter is deprecated.

Change: $retval [] = new JParameter(JPluginHelper::getPlugin('system', 'passwordcontrol')->params);

To: $plugin = JPluginHelper::getPlugin('system','passwordcontrol');
         $pluginParameters = new JRegistry();
         $pluginParameters->loadString($plugin->params);
         $retval [] = $pluginParameters;

 15. A number of function calls have been changed to resolved warning messages encountered when site reporting is set to 'Development'.  Most of these involve removing the '&' from the the calls to JFactory etc.

16. Discovered that modal windows are not opened and a full window is presented if the XML description text contains a window link when a plugin is installed (or displayed in the plugin manager).  In Joomla 2.5. the self same code opens a modal window, but with the Isis template a full window is opened.  We are using the modal window to display a changelog for our plug-ins.  Not a show stopper but slightly annoying never the less. Resolved by adding JHtml::_('behavior.modal') to template.

17. Review usage of jimport.  Should we be using JLoader::import instead?  jimport is a simple wrapper around the JLoader call and has been there since Joomla 1.0 but does it have a future?

18. Seeing the following message with using the search mechanism:

Notice: iconv() [function.iconv]: Wrong charset, conversion from `UTF-8' to `ASCII//TRANSLIT//IGNORE' is not allowed in /J31/administrator/components/com_search/helpers/search.php on line 233

 

Handling both Isis and Hathor admin templates

With the change to using bootstrap in the Joomla back end, provides a new 'opportunity' to have to support two possible admin templates.  If one converts all the views to use bootstrap so that Isis displays are correct. they do not display correctly if one uses the Hathor template. 

The answer is of course to make use of template overrides. Fortunately the 'old' templates designed for Joomla 2.5 display corrrectly with only a few minor changes in the Hathor template.

It is desirable to install the Hathor template overriides when the component is installed, and likewise remove them when the component is uninstalled.  There does not appear to be any way in which one can automate this process using the standard manifest file.  Instead it is necessary to perform the task within the 'installation script' itself. This works well with our components and is relatively easy to implement.

Of course changes would be required if any of the 'new' Joomla 3.x features are required, such as tag support.

Note that the JHtml tabs work with the Hathor template but it is necessary to use the JHtml bootstrap panes with the Isis template.

Joomla 3.1 observations

  1. Observed that the use of the JHtml:: bootstrap tabs has changed between 3.0 and 3.1. This resulted in the 3.0 changes failing in 3.1.  Most of the documentation still refers to the 3.0 code base, and has not yet been modified for Joomla 3.1. With the official release it has changed yet again. Instead of using bootstrap.startPane use bootstrap.startTabSet, instead of addPane use addTab, etc.

  2. Tags component is nice and reasonably easy to add to our component. [Pity in one way that it keeps changing between each beta release, but such is the way with beta code. :-) ]. Tags support doesn't seem to be present in base components with Hathor template!

  3. Looks like tags implementation has changed again in 3.1.4/3.1.5 since it now appears be be using observer.  More changes to make, so much for backward compatibility. 3.1.2 worked fine with our Alpha release. A fix is supposedly being developed for Joomal 3.1.6/3.2(?) but it is easy to modify the existing set up just by changing the Table class as described in this document.

  4. Differences between protostar and Beez 3 templates means that chosing a style that is consistent with both is difficult.

  5. Legacy View problems in 3.1.4. We do not currently think this affects our components. See this post for more details. There is expected to be a 3.1.5 release shortly, but in the meantime this fix may help.

  6. When reporting is set to 'Development there is an undesirable side effect that the size of the displayed text in list and item views is reduced to almost being impossible to read.

 Resolved Problems

1. Front end column sort did not seem to work in Joomla 3.1. Even the distribution base components (i.e. contacts) didn't sort.  Code call to Joomla.tableordering was suspected to be the cause. Works in back end fine.  This was tracked down to an undefined variable causing a Java exception.

Resolved: This was determined to be a problem with the underlying component templates not setting the undefined variable. It seems that Joomla 3.1 is not quite as forgiving as Joomla 2.5 in the templates defined.

Joomla 3.2

Whilst still in Alpha state, the following may not be present in the released version but it is worth noting the issues found so far.

1. The Smart Search Finder component is not working. No error messages just doesn't index anything.

2. The change to the new TinyMCE edit 4.0 has resulted in the back end edit boxes being full size with no apparently easy way to specify the size (height and width). This means that when there are two or more editing areas on a page then all occupy virtually a whole screen to each editor window. Very messy.

3. Using calendar type produces error:

Notice: Undefined index: class in /J32/libraries/cms/html/html.php on line 967

 

Supporting J2.5 and J3.x in one component

Have spent some time now working on integrating a Joomla 2.5 version and a Joomla 3.x version of our componnets into a single package.

There are a number of changes to consider but these break down into a few places as described below. There may be other places which depend upon the actual structure of the components but these were the ones that we determined for our components.

1. The changes nearly all involve the back end, which reflect the changes in the admin templates.

2. The changes can nearly all be allowed for by adding code of the following type:

$jversion = new JVersion();
if( version_compare( $jversion->getShortVersion(), '3.1', 'ge' ) )
{
   // Joomla 3.x code.
} else {
   // Joomla 2.5 code
}

3. The places to change fall into a few areas:

    1. In the helper files which display the list view menus in the sidebars.
    2. In the views where we need to change which template is being displayed.
    3. Alternative view templates (i.e default.php or default25.php).

4. Changes relating to the 'moving' of core files.

    1. Typically we have had problems with the moving of 'grid' support files.

 

Go To Top

Joomla! Debug Console

Session

Profile Information

Memory Usage

Database Queries