|
Écrit par Xavier
|
|
J'ai rencontré un souci pour utiliser PHPExcel dans un composant Joomla.
Les fonctionnalités d'autoload de Joomla et de PHPExcel ne s'aiment pas, donnant lieu à des erreurs de la forme :
Class 'JView' not found
Il faut alors remplacer la function __autoload du fichier J/libraries/loader.php comme suit :
/**
* When calling a class that hasn't been defined, __autoload will attempt to
* include the correct file for that class.
*
* This function get's called by PHP. Never call this function yourself.
*
* @param string $class
* @access public
* @return boolean
* @since 1.5
*/
//function __autoload($class)
//{
// if(JLoader::load($class)) {
// return true;
// }
// return false;
//
//}
// Remplacement de __autoload pour compatibilité PHPExcel
function Joomla_Autoload($class)
{ if(JLoader::load($class))
{ return true;
}
return false;
}
/*** specify extensions that may be loaded ***/
spl_autoload_extensions('.php, .class.php, .lib.php');
/*** register the loader functions ***/
spl_autoload_register('Joomla_Autoload');
|