We have 1 guest online

Newsflash

This web site will be in the next days obsolete - we move to new one :

http://www.kanich.net/radio/site/

The old links remain active for archive purposes but only new site shall keep the newest topics.

 
Home arrow Blog arrow Joomla Components Migration (1.0.x to 1.5)
Joomla Components Migration (1.0.x to 1.5) PDF Print E-mail
Wednesday, 26 September 2007

UPDATED 

Here are described necessary steps for proper code migration of Joomla 1.0.x components into new object and function environment of Joomla 1.5 (J15) running in native mode (non-legacy based on code of Joomla 1.5.2 version) .

Migration items can be clasified into the following groups:

  1. critical – classes, functions, objects used in Joomla 1.0.x which are not present in J15 mode (these items are causing fatal errors in J15 environment) see the migration table and selected API documentation (in the upper frame select package Joomla-Legacy for Joomla 1.0.x entities or Joomla-Framwork for J15 entities) .

  2. non-critical – items can be used in J15 but the general rules for their usage was already for J15 changed :
    1. MVC methodology implementation for front-end and back-end of the components
    2. text helpers / objects & I18N matters
    3. error processing
    4. resource paths

For critical type of changes can we give here some examples - code snippets from new version of SearchLog component dedicated to native J15 operation :

Front-end changes :

 

Initial declaration

##IFDEF J15

defined( '_JEXEC' ) or die( 'Restricted access' );

require_once( JApplicationHelper::getPath('class') );

require_once( JApplicationHelper::getPath('front_html') );

jimport('joomla.application.component.controller');

jimport('joomla.application.component.helper');

##ELSE

#defined( '_VALID_MOS' ) or die( 'Restricted access' );

#require_once( $mainframe->getPath( 'class' ) );

#require_once( $mainframe->getPath( 'front_html' ) );

##ENDIF

 

Database definition

##IFDEF J15

        $database = &JFactory::getDBO();

##ELSE

#global $database;

##ENDIF

 

Request Query parameter

##IFDEF J15

            $searchword = strval(JRequest::getVar( 'searchword', '' ));

##ELSE

#            $searchword = strval( mosGetParam( $_REQUEST, 'searchword', '' ) );

##ENDIF

 

Back-end changes :

 

Initial declaration

##IFDEF J15

defined( '_JEXEC' ) or die( 'Restricted access' );

require_once( JApplicationHelper::getPath('class') );

require_once( JApplicationHelper::getPath('admin_html') );

jimport('joomla.application.component.controller');

jimport('joomla.application.component.helper');

jimport('joomla.database.table.component');

##ELSE

#defined( '_VALID_MOS' ) or die( 'Restricted access' );

#require_once( $mainframe->getPath( 'class' ) );

#require_once( $mainframe->getPath( 'admin_html' ) );

##ENDIF

 

Request Query parameter

##IFDEF J15

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

##ELSE

#$task = mosGetParam($_REQUEST, 'task');

##ENDIF

 

Page redirection

##IFDEF J15

            $mainframe->redirect('index2.php?option=' . $option . '&act=managelog');

##ELSE

#          mosRedirect('index2.php?option=' . $option . '&act=managelog');

##ENDIF

 

Database definitions

##IFDEF J15

        $database = &JFactory::getDBO();

##ELSE

#global $database;

##ENDIF

 

##IFDEF J15

    $row = new JTableComponent($database);

##ELSE

#    $row = new mosComponent($database);

##ENDIF

 

Parameters

##IFDEF J15

        $params = new JParameter($row->params, $mainframe->getPath('com_xml', $row->option), 'component');

##ELSE

#    $params = new mosParameters($row->params, $mainframe->getPath('com_xml', $row->option), 'component');

##ENDIF

 

Pagination

##IFDEF J15

    $database = &JFactory::getDBO();

            $limit                = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );

            $limitstart        = $mainframe->getUserStateFromRequest( $option.'limitstart', 'limitstart', 0, 'int' );

            $search= $mainframe->getUserStateFromRequest( $option.'.search','search','','string');

            $search                      = JString::strtolower( $search );

            $callbase = JRequest::getVar('callbase', 1);

##ELSE

#          global $database,$mosConfig_list_limit,$mosConfig_absolute_path;

#    $limit = intval($mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit));

#    $limitstart = intval($mainframe->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0));

#    $search = $mainframe->getUserStateFromRequest("search{$option}", 'search', '');

#    $search = $database->getEscaped(trim(strtolower($search)));

#    $callbase = mosGetParam($_REQUEST, 'callbase', 1);

##ENDIF

 

##IFDEF J15

            jimport('joomla.html.pagination');

            $pageNav = new JPagination( $total, $limitstart, $limit );

##ELSE

#    require_once($GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php');

#    $pageNav = new mosPageNav($total, $limitstart, $limit);

##ENDIF

 

Usage of cid parameter

##IFDEF J15

    $database = &JFactory::getDBO();

    $cid             = JRequest::getVar( 'cid', array(0), '', 'array' );

    JArrayHelper::toInteger($cid, array(0));

##ELSE

#          global $database,$mosConfig_list_limit,$mosConfig_absolute_path;

#           $cid = josGetArrayInts('cid');

##ENDIF

Last Updated ( Sunday, 13 July 2008 )
 
© 2008 OM1VA Amateur Radio Site
Joomla! is Free Software released under the GNU/GPL License.