How to convert Joomla extensons from 1.5.x to 2.5.x and 3.x

Joomla is best CMS, the platform Milions of Websites are building on.
Features:

  • More than 35 Milion DOWNLOAD
  • Thousads Extensions and Designs
  • User Friendly and Mobile Ready

Joomla administration has a brand new look and feel, built with the power of Bootstrap responsive framework, along with a touch of the awesome UI/UX work of the Joomla JUX team. Joomla comes ready to go and fully responsive for mobile devices, tablets, and normal computer screens. The entire backend of Joomla has a brand new look and feel that will improve your workflow with any type of device.
How to migration Joomla extensions from 1.5.x to Joomla 2.5.x and 3.x.

convert Joomla extensons from 1.5.x to 2.5.x and 3.x

Global variables $mainframe and $option

joomla 1.5.x

global $mainframe, $option;

in Joomla 2.5.x and 3.x:

$mainframe =& JFactory::getApplication();
$option = JRequest::getCmd('option');

or

$option = $this->option //If the code is in a controller class derived from JControllerForm

Get page title within a template

Joomla 1.5.x

global $mainframe;
$mainframe = &JFactory::getApplication();
$page_title = $mainframe->getPageTitle();

in Joomla 2.5.x and 3.x replaced with

$app =& JFactory::getDocument();
$page_title = $app->getTitle();

Template Path

Joomla 1.5.x

“templates/templatename/”

Joomla 2.5.x

$app= & JFactory::getApplication();
$template = $app->getTemplate();

or

"templates/".$this->template."/"

How to find out if you are on the homepage

Joomla 1.5.x

if( JRequest::getVar(‘view’) == “frontpage” ) {
// You are on the home page
} else {
// You are not
}

Joomla 2.5.x and 3.x

$menu =& JSite::getMenu(); // get the menu
$active = $menu->getActive(); // get the current active menu
if ( $active->home == 1 ) { // check if this is the homepage
// You are on the home page
} else {
// You are not
}

Accessing Error Variables

Joomla 1.5.x

$code = $this->error->code;
$message = $this->error->message;

Joomla 2.5.x and 3.x

In Joomla 2.5.x those variable are now private and have to be accessed via getter methods to avoid the following error:
PHP cannot acess protected property error

$code = $this->error->getCode();
$message = $this->error->getMessage();

Replaced Module

Some modules were replaced. For example mod_latestnews in Joomla 1.5.x was replaced by mod_articles_latest in Joomla 2.5.x, so you’ll need to update template overrides
Article template override

If you have a custom article template override (/templates/YOURTEMPLATE/html/com_content/article) then you’ll need to replace all occurrences of $this->article with $this->item. show_page_title was also needs to be replaced by show_page_heading

Joomla 1.5.x

$this->params->get('show_page_title', 1)
$this->article...

Joomla 2.5.x

$this->params->get('show_page_heading')
$this->item...

Be Sociable, Share!

Leave a comment