This is the first of our Blogs in the Joomla 3.0 Discovery series. Joomla 3.0 is an awesome release & we are discovering new stuff with it as we use it every day. We hope to share our new found knowledge with the community through this series. The series will cover topics for end users, administrators as well as developers.
We are working on ‘Converting common installable packages for “Joomla 1.5.x & 2.5.x” to “Joomla 3.0” ’. Here are the minimal changes we had to make to get it to work on Joomla 3.0. Note that, some of the changes mentioned below were ideally should have been made in ‘joomla 1.5 to Joomla 1.6’ & ‘joomla 1.7 to Joomla 2.5’ conversions BUT as we had to keep single installable package for all Joomla versions including 1.5.x, 1.6.x, 1.7.x, 2.5.x we skipped some of those changes needed during those conversion phases.
Changed From
<install type="component" version="1.5.0" method="upgrade"> </install>
Changed to
<extension type="component" version="3.0" method="upgrade"> </extension>
Changed From
<name>JBolo!</name>
Changed to
<name>com_jbolo</name>
Changed From
<administration> <menu img="../administrator/components/com_jbolo/images/jbolo_menu.png">COM_JBOLO</menu>
Changed to
<administration> <menu link="option=com_jbolo" img="../administrator/components/com_jbolo/images/jbolo_menu.png">com_jbolo</menu>
Changed From
<filename>admin.jbolo.php</filename>
Changed to
<filename>jbolo.php</filename>
Changed From
<installfile>install.jbolo.php</installfile>
Changed to
<scriptfile>install.jbolo.php</scriptfile>
Changed From
<install type="module" version="1.5.0" method="upgrade"> </install>
Changed to
<extension type="module" version="3.0" method="upgrade"> </extension>
Changed From
<install version="1.5" type="plugin" group="system" method="upgrade"> </install>
Changed to
<extension version="3.0" type="plugin" group="system" method="upgrade"> </extension>
These changes are done to remove strict warnings which are shown when we set “Error reporting” to “Development”.
// Changed from $mainframe=&JFactory::getApplication(); $user=&JFactory::getUser(); $doc=&JFactory::getDocument(); $module=&JModuleHelper::getModule('customjbolo');
// Changed to $mainframe=JFactory::getApplication(); $user=JFactory::getUser(); $doc=JFactory::getDocument(); $module=JModuleHelper::getModule('customjbolo');
// Changed from
JTable::_getAssetParentId($table = NULL, $id = NULL)
// to
JTable::_getAssetParentId(JTable $table = null, $id = null)
You either need to add this code in your component entry file or use ‘DIRECTORY_SEPARATOR’ instead of ‘DS’
We have added this code in system plugin entry file - plg_sys_jbolo_asset/plg_sys_jbolo_asset.php
if(!defined('DS')){ define('DS',DIRECTORY_SEPARATOR); }
To access module parameters inside a plugin
//changed code from - $module=JModuleHelper::getModule('jbolo'); $moduleParams=new JParameter($module->params); $chatmode=intval($moduleParams->get('modorbar',1)); //to $module=JModuleHelper::getModule('jbolo'); $moduleParams=json_decode($module->params); $chatmode=$moduleParams->modorbar;
//Changes to model- //from class JboloModelSendFile extends JModel //to class JboloModelSendFile extends JModelLegacy
//Changes to controller- //from class JboloController extends JController //to class JboloController extends JControllerLegacy
//Changes to view- //from class JboloViewHistory extends JView //to class JboloViewHistory extends JViewLegacy
//from
function display()
//to
public function display($cachable = false, $urlparams = false)
//changed from JFactory::getDate()->toFormat; //to JFactory::getDate()->Format;
example-
//changed from- $message=sprintf(JText::_('SENT_AT'),JFactory::getDate($time)->toFormat(JText::_("SENT_AT_FORMAT"))); //to $message=sprintf(JText::_('SENT_AT'),JFactory::getDate($time)->Format('SENT_AT_FORMAT'));
to achieve date format: 6:27 PM October 12
// changed from SENT_AT_FORMAT="%l:%M%p %B %e" // to SENT_AT_FORMAT="g:iA F y"
To achieve date format: Wednesday, 03 October 2012
// changed from HIST_DATE_FORM="%A %e %B %Y" // to HIST_DATE_FORM="l, d F Y"
Remove
admin.jbolo.php
Use
jbolo.php
otherwise shows component not found error
//changed from $parser=JFactory::getXMLParser('Simple'); $xml=JPATH_COMPONENT.DS.'jbolo.xml'; $parser->loadFile($xml); $doc=$parser->document; $element=$doc->getElementByPath('version'); $version=$element->data(); //to $xml=JFactory::getXML(JPATH_COMPONENT.DS.'jbolo.xml'); $version=(string)$xml->version;
//changed from $get_date=JFactory::getDate(); $date=$get_date->toMysql(); //to $get_date=JFactory::getDate(); $date=$get_date->toSql();
//changed from JHTML::_('behavior.mootools'); //to JHtmlBehavior::framework();
To use the new JMail::sendMail() you also need to have the following library imported.
jimport('joomla.mail.mail');
* Thanks Walt for update!
//changed from $db->query(); //to $db->execute();
//changed from $smileysfile = JFile::read(JPATH_COMPONENT . DS . 'smileys.txt'); //to $smileysfile=file_get_contents(JPATH_COMPONENT.DS.'smileys.txt');
http://docs.joomla.org/Retrieving_request_data_using_JInput
//changed from $post=JRequest::get('post'); JRequest::getVar('badwords'); //to $input=JFactory::getApplication()->input; $post=$input->post; $input->post->get('badwords')
//from $task = JRequest::getVar('task'); //to $task=$input->get('task');
//from $groupid = JRequest::getVar('id'); //to $groupid=$input->get('id');
//from $limitstart=JRequest::getVar('limitstart', 0, '', 'int'); //to $limitstart=$input->get('limitstart','0','INT');
//from $controller=JRequest::getWord('controller'); //to $controller=$input->get('controller');
//from $controller->execute(JRequest::getCmd('action')); //to $controller->execute($input->get('action'));
//changed from $this->assignRef( 'userlist', $userlist ); //to $this->userlist=$userlist;
* Thanks Walt for update!
When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.