dongsheng4126335 2014-06-18 16:57
浏览 29
已采纳

在另一个Joomla安装中没有使用Joomla组件

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!

  • 写回答

1条回答 默认 最新

  • dragon4808 2014-06-23 11:53
    关注

    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 ;-).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?