Search code examples
phpjoomlajoomla-extensionsjoomla3.2joomla3.3

Not working Joomla component at another Joomla installation


I'm facing troubles with a self developed Joomla (backend) component. I developed it without any troubles and it is working fine on my development Joomla.

After installing the component on another Joomla system (different version) the component itself seems to work fine - but when selecting an entry to edit or to create a new one I'm receiving an error saying that he doesn't find the custom helper classes I developed.

I'm registering the classes as it is needed regarding the docs - and as already mentioned: it is working FINE with my development Joomla.

For testing I loaded the helpers "by hand" with require_once() - the error message itself is gone, but it doesn't work either. It doesn't even load the custom view but is showing the default listing.

Has anyone an idea what goes wrong? The installation itself (via zip) was without any messages.

  • Development Joomla version: 3.2.2
  • Client Joomla version: 3.3.1

Code excerpts for imports

controller.php

class DhhcController extends JControllerLegacy {
  /* ... */
  public function display($cachable = false, $urlparams = false) {
    JLoader::register('DhhcHelper', JPATH_COMPONENT .'/helpers/dhhc.php');
    JLoader::register('LanguageHelper', JPATH_COMPONENT .'/helpers/language.php');

    // ...
  }
}

Any help appreciated - thanks!


Solution

  • I found out what was missing but still don't know why I needed it in that specific installation.

    After cloning the client installation to my development machine I tried out several different things (deactivating different components...) but nothing helped me out. That specific Joomla installation from the client (with the same Joomla version!) didn't work with the component running on my Joomla dev installation on the same machine.

    I debugged and debugged and found out what's preserving the component from working correctly after quiet a long time yet still don't know why exactly.

    In dhhc.php (main file) I modified the file to that part:

    <?php
    // ...
    require_once(JPATH_COMPONENT .'/helpers/dhhc.php');
    require_once(JPATH_COMPONENT .'/helpers/language.php');
    
    JLoader::register('DhhcHelper', JPATH_COMPONENT .'/helpers/dhhc.php');
    JLoader::register('LanguageHelper', JPATH_COMPONENT .'/helpers/language.php');
    
    $controller = JControllerLegacy::getInstance('Dhhc');
    $controller->execute(JFactory::getApplication()->input->get('task'));
    $controller->redirect();
    

    Now it is working as expected.

    I'm still wondering why my dev installation was including the controller.php on every site while at the client`s installation the controller.php was only included on the main controllers directly selected from the side toolbar.

    Maybe someone can help this out ;-).