Joomla, Falang集成组件…致命错误:在null上调用成员函数getTable()


Joomla, Falang integrate component... Fatal error: Call to a member function getTable() on null

你好,我有一些问题集成的自定义组件joomla在Falang多语言网站

调试I got null:

致命错误:在null上调用成员函数getTable()

object(contenttobject)[183] public '_contentElement' => null

集成组件的XML如下:

 <?xml version="1.0"?>
    <falang type="contentelement">
      <name>Members</name>
      <author>Stackoverflow.com</author>
      <version>1.0.0</version>
      <description>Definition for the core Members component</description>
      <copyright>stackoverflow.com</copyright>
      <reference>
        <table name="chambercommerce_members">
            <field type="referenceid" name="id" translate="0">ID</field>
            <field type="titletext" name="company_name" translate="1">Company Name</field>
            <field type="text" name="country" translate="1">Country</field>
            <field type="text" name="benefits_discounts" translate="1">Benefits</field>
            <field type="text" name="web" translate="0">Web</field>
        </table>
      </reference>
      <translationfilters>
         <frontpage>id</frontpage>
         <keyword>company_name</keyword>
         <id>id</id>
      </translationfilters>
    </falang>

我让我的xml看起来像其他的在我的joomla安装的falang,有这个var_dump。

<em>object(ContentObject)[180]  public '_contentElement' => object(ContentElement)[179]  public '_xmlFile' => ...</em>

有什么帮助吗?

调用堆栈:

( ! ) Fatal error: Call to a member function getTable() on null in C:'xampp2'htdocs'website.com'administrator'components'com_falang'models'ContentObject.php on line 747
Call Stack
#   Time    Memory  Function    Location
1   0.0009  134496  {main}( )   ...'index.php:0
2   0.0741  2216528 JApplicationCms->execute( ) ...'index.php:42
3   0.0741  2216792 JApplicationAdministrator->doExecute( ) ...'cms.php:245
4   0.1535  4563008 JApplicationAdministrator->dispatch( )  ...'administrator.php:159
5   0.1565  4603072 JComponentHelper::renderComponent( )    ...'administrator.php:98
6   0.1614  4636208 JComponentHelper::executeComponent( )   ...'helper.php:332
7   0.1621  4669360 require_once( 'C:'xampp2'htdocs'website.com'administrator'components'com_falang'falang.php' )   ...'helper.php:352
8   0.2074  5752552 JControllerLegacy->execute( )   ...'falang.php:78
9   0.2074  5752848 TranslateController->editTranslation( ) ...'legacy.php:722
10  0.2172  6208560 TranslateViewTranslate->display( )  ...'translate.php:245
11  0.2374  6515680 FalangViewDefault->display( )   ...'view.php:80
12  0.2470  6795128 JViewLegacy->display( ) ...'view.php:70
13  0.2470  6795384 JViewLegacy->loadTemplate( )    ...'legacy.php:211
14  0.2499  6900192 include( 'C:'xampp2'htdocs'website.com'administrator'components'com_falang'views'translate'tmpl'edit.php' ) ...'legacy.php:663
15  0.2500  6900664 ContentObject->getTable( )

我做到了。

问题:xml名称应该等于数据库表名称。所以我重命名为mytable.xml,它工作得很好

如果你使用尼奥翻译,你不需要创建一个内容元素文件,因为它可以翻译任何第三方组件开箱即用。它也是专门为Joomla 3编写的,并且有一些Falang没有的特性。