Additional Joomla 1.0 modifications

(1 vote, average 5.00 out of 5)
NOTE: these patches are not required for Joomla 1.5!

In Joomla 1.0, MetaMod works best in if some changes are made to a core Joomla file. These changes allow you to see the list of modules and their ID numbers on the mod_metamod configuration page. This saves you having to flick back and forth between the Site Modules page and MetaMod page in order to get hold of the module ID numbers.

For reference, here are the changes made in the above files:

Before (from administrator/components/com_modules/admin.modules.php:441)
  $xmlDoc->resolveErrors( true );
  if ($xmlDoc->loadXML( $xmlfile, false, true )) {
    $root = &$xmlDoc->documentElement;
 
    if ($root->getTagName() == 'mosinstall'
        && $root->getAttribute( 'type' ) == 'module' ) {
      $element = &$root->getElementsByPath( 'description', 1 );
      $row->description = $element ? trim( $element->getText() ) : '';
    }
  }
 
  // get params definitions
  $params = new mosParameters( $row->params, $xmlfile, 'module' );
After (from line 441):
$xmlDoc->resolveErrors( true );
$new_param_class="";
$new_param_class_loaded=false;
if ($xmlDoc->loadXML( $xmlfile, false, true )) {
  $root = &$xmlDoc->documentElement;
  if ($root->getTagName() == 'mosinstall' 
      && $root->getAttribute( 'type' ) == 'module' ) {
    $element = &$root->getElementsByPath( 'description', 1 );
    $row->description = $element ? trim( $element->getText() ) : '';
    $parameter_class_node = 
      &$root->getElementsByPath( 'files/filename', 1 );
    if ($parameter_class_node) {
      $new_param_class = 
        substr($parameter_class_node->getAttribute( 'module' ),4);
      if (file_exists($mosConfig_absolute_path . 
          "/modules/mod_$new_param_class/$new_param_class.class.php")) {
        require_once( $mosConfig_absolute_path . 
          "/modules/mod_$new_param_class/$new_param_class.class.php" );
        $new_param_class_loaded = true;
      }
    }
  }
}
if ($new_param_class_loaded 
    && $new_param_class 
    && class_exists($new_param_class."Parameters"))
  $new_param_class .= "Parameters";
// get params definitions:
$param_class = ($new_param_class_loaded && $new_param_class) ? 
  $new_param_class : "mosParameters";
$params = new $param_class( $row->params, $xmlfile, 'module' );
Last Updated on Monday, 07 September 2009 11:07