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

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

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?