====== Migrating to 1.5 Quick Reference ====== This page forms a summary of new techniques available in the version 1.5 API and their version 1.0 counterparts where applicable. ===== PHP Related ===== ==== Handling Input ==== ^ Old Way / Usage ^ New Way ^ | $id = mosGetParam( $_REQUEST, 'id', 0 ); | $id = JRequest::getVar( 'id', 0 ); | ==== Global Vars ==== ^ Old Way / Usage ^ New Way ^ | global $acl; | $acl =& JFactory::getACL(); | | global $mosConfig_live_site; | $mainframe->getCfg( 'live_site' ); | | global $database; | $database = $mainframe->getDBO(); // or: $database = &JFactory::getDBO(); | ==== Raising Errors ==== ^ Old Way / Usage ^ New Way ^ | mosNotAuth(); | JError::raiseError( 403, JText::_("ALERTNOTAUTH") ); | | A fatal error | if (!$row->check()) { JError::raiseError( 500, $row->getError()); } | ==== Including common files ==== ^ Old Way / Usage ^ New Way ^ | $mainframe->getPath( 'admin_html' ) | JApplicationHelper::getPath('admin_html') | ==== Internationalization Support ==== ^ Old Way / Usage ^ New Way ^ | echo _HELLO; | echo JText::_( 'Hello' ); | | UTF8 Safe Lower Casing | $search = JString::strtolower($search) ==== Common Component Coding ==== ^ Old Way / Usage ^ New Way ^ | List pagination | jimport('joomla.presentation.pagination'); $pagination = new JPagination($total, $limitstart, $limit); | ==== File Handling ==== ^ Old Way / Usage ^ New Way ^ | Listing files or folders mosReadDirectory(...) | JFolder::files(...) // or JFolder::files(...) | ==== Miscellaneous ==== ^ Old Way / Usage ^ New Way ^ | Get the menu parameters in a component (frontend) | jimport('joomla.application.extension.component'); $mParams = &JComponentHelper::getMenuParams(); // example: $pageclass_sfx = $mParams->get( 'pageclass_sfx' ); | | Get the control (model, view, controller, renderer, template) parameters in a component (frontend) | jimport('joomla.application.extension.component'); $cParams = &JComponentHelper::getControlParams(); // example: $viewName = $cParams->get('view_name'); | | | | ===== HTML Related ===== ==== Buttons ==== The use of the BUTTON tag is prefered to INPUT. ^ Old Way / Usage ^ New Way ^ | Submit Button | |