Joomla Changes from 1.5 to 1.6, 1.7, and 2.5: $mainframe and jos_components

Posted by on Apr 14, 2012 in Joomla, Technology, Web Development | No Comments

Joomla LogoWas looking to convert one of my Joomla 1.5 components into a Joomla 2.5 component and ran into a couple of show-stopping changes.

1) The jos_components table is gone. Just gone. This is the table that among many other varied purposes used to hold the admin component’s menu hierarchy. It’s now been rolled into jos_menu, which is potentially much cleaner. To migrate from the old site’s jos_components method to the new jos_menu method, I exported the pertinent records from jos_components as a SQL dump, then found a similarly configured component in a stock Joomla 2.5 install (I used the Banners component, which has four child menus) to use as a base. This allowed me to manually migrate my component’s menus on the new site.

Note: Also had to manually create an entry in jos_extensions for the component. Might be simpler going forward to simply create an install package/manifest and let Joomla take care of all this itself going forward. Sigh. Starting to miss the good old days of 1.5. Heh.

2) The $mainframe global variable is gone. Just gone. Seems to be a pattern. 😉 To get around this, I took some advice from this post. However, instead of adding the $mainframe declaration in the Joomla core like the author suggested (yikes!), I added it to the variable file I had that referenced it: The admin component, the front-end component, and the functions.php file in my template.

<?php
defined(‘_JEXEC’) or die(‘Restricted access’); // no direct access

// $mainframe was deprecated in 1.6, so adding back in so component works in 1.6+
global $mainframe;
$mainframe = JFactory::getApplication();

Leave a Reply

You must be logged in to post a comment.