Switching from Joomla 1.5 to Joomla 1.6 for programmers

08.07.2011

Joomla

In this article, I will talk about the difficulties that I had in migrating from Joomla 1.5.23 to Joomla 1.6.4 and how I coped with them.

The changes drastically affected the structure of the database, related, among other things, to the introduction of advanced access and different styles for templates.

Components

The `jos_components` component table no longer exists, components, like any other extensions, including localization, templates, and modules, are now registered in the `jos_extensions` table.

An example of registering the main component of the site.

INSERT INTO `jos_extensions`
	(`extension_id`,`name`,`type`,`element`,`client_id`,`protected`,`manifest_cache`)
VALUES
	(40,'Ceramoteka','component','com_ceramoteka',1,1,`{"legacy":false,"name":"Ceramoteka","type":"component","creationDate":"07.07. 2011","author":"Ilya Indigo","version":"1.6.4","description":"Ceramoteka"}`);

Then, in order to register the subcomponents of our component, or rather the components of our site, they need to be registered not in the `jos_menu` table.

An example of registering site components in the menu table.

INSERT INTO `jos_menu`
	(`id`,`menutype`,`title`,`alias`,`path`,`link`,`type`,`parent_id`,`level`,`component_id`,`ordering`,`img`,` home`,`language`,`client_id`)
VALUES
	(40,'main',' Ceramoteka ',' Ceramoteka ',' Ceramoteka ','index.php?option=com_ceramoteka','component',1,1,40,0,'../images/icons/icon -16.png',0,'*',1),
	(41,'main','Text Pages','Text Pages','Text Pages','index.php?option=com_ceramoteka&tab=text','component',40,2,40,1,'../ images/icons/icon-16.png',1,'*',1),
	(42,'main','Catalog','Catalog','Catalog','index.php?option=com_ceramoteka&tab=catalog','component',40,2,40,2,'../images/icons /icon-16.png',0,'*',1),
	(43,'main','Our projects','Our projects','Our projects','index.php?option=com_ceramoteka&tab=portfolio','component',40,2,40,3,'../ images/icons/icon-16.png',0,'*',1),
	(44,'main','News','News','News','index.php?option=com_ceramoteka&tab=news','component',40,2,40,4,'../images/icons /icon-16.png',0,'*',1),
	(45,'main','Partners','Partners','Partners','index.php?option=com_ceramoteka&tab=partner','component',40,2,40,5,'../images/icons /icon-16.png',0,'*',1),
	(46,'main','Configuration','Configuration','Configuration','index.php?option=com_ceramoteka&tab=config','component',40,2,40,6,'../images/icons /config-16.png',0,'*',1);

And also in connection with the introduction of access levels, the code of the quick icons module, to automatically create a convenient menu in the site admin panel, located in the administrator/modules/mod_quickicon/mod_quickicon.php folder, we change the next one.

An example of the quick icons menu code.

 authorize($access[$i],$access[$i+1])) return false;
		}
		$current = (!$current) ?NULL :' class="current"';
		echo'
',JHTML::_('image.site',$image,NULL,NULL,NULL,$text),' ',$text,'
'; } echo '
'; JFactory::getDBO()->setQuery('SELECT `link`,`img`,`title` FROM jos_menu WHERE `parent_id`=40 ORDER BY `ordering`'); $res = &JFactory::getDBO()->loadObjectList(); if (isset($res[0])) { foreach ($res as $menu) { if (!isset($_REQUEST['tab'])) $_REQUEST['tab'] = NULL; $img = (is_file($img = strtr($menu->img,array('-16'=>NULL)))) ?$img :'../images/icons/icon.png'; $current = ($_REQUEST['tab'] != substr($menu->link,strpos($menu->link,'tab='.$_REQUEST['tab'])+4)) ?false :true ; $access = array('core.manage','com_users'); quickiconButton(htmlspecialchars($menu->link),htmlspecialchars($img),htmlspecialchars($menu->title),$current,$access); } } $current = ($_REQUEST['option'] != 'com_users') ?false :true; quickiconButton('index.php?option=com_users','templates/'.$app->getTemplate().'/images/header/icon-48-user.png',JText::_('MOD_QUICKICON_USER_MANAGER'), $current,array('core.manage','com_users')); $current = ($_REQUEST['option'] != 'com_config') ?false :true; quickiconButton('index.php?option=com_config','templates/'.$app->getTemplate().'/images/header/icon-48-config.png',JText::_('MOD_QUICKICON_GLOBAL_CONFIGURATION'), $current,array('core.manage','com_config','core.admin','com_config')); echo'
'; ?>

It is assumed that the icons of our menu are in the images / icons folder, in this format 16 * 16 - the icon, the path of which is written in the `jos_menu` table for the corresponding site component, has the form icon-16.png, and the 48 * 48 icon is needed to display in this menu has the form icon.png.

In a nutshell, the string '-16' in the icon name is discarded and tries to find an icon with this new name, if it does not work, then an icon with the name icon.png is substituted, which should always be there.

Templates

in order for the template manager to define our template, it is simply not enough to copy it to the templates folder. Now it also needs to be explicitly registered first in the extension table.

Registering a Template in the Extensions Table

INSERT INTO `jos_extensions`
	(`extension_id`,`name`,`type`,`element`,`client_id`,`protected`,`manifest_cache`)
VALUES
	(506,'Main','template','main',0,1,`{"legacy":false,"name":"Main","type":"template","creationDate":"07, 07.2011","author":"Ilya Indigo","version":"1.6.4","description":"Main"}`);

And then also register, as a minimum 1, the style of this template in the template style sheet.

Registering a Template Style in a Template Style Sheet

INSERT INTO `jos_template_styles`
	(`template`,`title`)
VALUES
	('main','Main');

Menu of the client part of the site.

I have never been able to get the menu manager to link to something other than one of my components. Most likely, he does not do this at all, so the process of creating the main and hidden menus of the site, or rather, linking menu items to components, is done entirely manually through tables.

First, the required menu modules are registered in the module table.

Registering Menu Modules in the Module Table

INSERT INTO `jos_modules`
	(`id`,`title`,`position`,`published`,`module`,`access`,`showtitle`,`language`)
VALUES
	(19,'Main menu','menu',1,'mod_menu',1,0,'*'),
	(20,'Hidden menu','hidden',0,'mod_menu',1,0,'*');

And then they are added to the `jos_modules_menu` table, where 19,20 is the id of the corresponding menu modules in the `jos_modules` table.

Registering a module in the module table

INSERT INTO `jos_modules_menu`
	(`moduleid`)
VALUES
	(19),
	(twenty);

After registration of menu modules, manual binding of menu items to components is carried out in the `jos_menu` table.

Linking Menu Items to Components in a Menu Table

INSERT INTO `jos_menu`
	(`id`,`menutype`,`title`,`alias`,`path`,`link`,`type`,`parent_id`,`level`,`component_id`,`ordering`,`img`,` home`,`language`,`client_id`)
VALUES
	(51,'mainmenu','Main','index','index','index.php?option=com_ceramoteka&view=index','component',1,1,40,1,'',1,'* ',0),
	(52,'mainmenu','Catalog','catalog','catalog','index.php?option=com_ceramoteka&view=catalog','component',1,1,40,2,'',0,'* ',0),
	(53,'mainmenu','Our projects','portfolio','portfolio','index.php?option=com_ceramoteka&view=portfolio','component',1,1,40,3,'',0,' *',0),
	(54,'mainmenu','News','news','news','index.php?option=com_ceramoteka&view=news','component',1,1,40,4,'',0,'* ',0),
	(55,'mainmenu','About','about','about','index.php?option=com_ceramoteka&view=about','component',1,1,40,5,'',0,' *',0),
	(56,'mainmenu','Partners','partner','partner','index.php?option=com_ceramoteka&view=partner','component',1,1,40,6,'',0,'* ',0),
	(57,'mainmenu','Vacancy','vacancy','vacancy','index.php?option=com_ceramoteka&view=vacancy','component',1,1,40,7,'',0,'* ',0),
	(58,'mainmenu','Contacts','contact','contact','index.php?option=com_ceramoteka&view=contact','component',1,1,40,8,'',0,'* ',0);

Modules

In order for the module manager to define our module, it is simply not enough to copy it to the modules folder, and then call the "Create" dialog. Now it also needs to be explicitly registered in the module table.

Registering a module in the module table

INSERT INTO `jos_modules`
	(`id`,`title`,`position`,`published`,`module`,`access`,`showtitle`,`language`)
VALUES
	(21,'Catalog','catalog',1,'mod_catalog',1,0,'*');

And then add it to the `jos_modules_menu` table, where 21 is the id of the corresponding module in the `jos_modules` table.

Registering a module in the module table

INSERT INTO `jos_modules_menu`
	(`moduleid`)
VALUES
	(21);

Also, instead of the $mainframe object, the global $app object is used.

Not an example if we previously called the redirect function with such code.

redirect('index.php');
?>

Then in Joomla 1.6 it will be executed by such code.

redirect('index.php');
?>

Well, there are also smaller problems not related to changing the structure of the database, such as:

  • The lack of a ready-made Russified joom.ru assembly, and the need to manually Russify Joomla 1.6.
  • You will have to re-style the new bluestork admin template.
  • The absence of the installed version of Joomla in the footer of the site, in the new bluestork template, which needs to be displayed by editing the template.

Last in our blog

Internet Marketing
04.11.2019