组件在joomla中不起作用

时间:2015-11-29 10:59:09

标签: php joomla

我是joomla和php的初学者。我正在joomla做一个openchat应用程序。

我创建的目录结构如下: com_openchat /管理员/组件/ com_openchat

我只想启用控制器在我的代码中工作,这是没有发生的。 与此相关的文件是:

Controller.php这样 这将控制器类定义如下:

<?php
defined('_JEXEC') or die("Access Deny");
error_reporting(E_ALL);
ini_set('display_errors',1);
jimport('legacy.controller.legacy');
class OpenChatController extends JControllerLegacy{
    function display(){
        JToolBarHelper::Title('Default');
        echo JText::_('COM_OPENCHAT');
    }
    function history(){
        echo "Chat history";
    }
    function blocked_user(){
        JToolBarHelper::Title('BLOCKED USERS');
        echo JText::_('COM_OPENCHAT_BLOCKED'); 
        echo "Welcome to list viaJcontoller";   
    }
}
?>

myopenchat.php 这将执行控制器的实例,如下所示:

<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
defined('_JEXEC') or die("Access Deny");
jimport('legacy.controller.legacy');
$controller=JControllerLegacy::getInstance('OpenChat');
$controller->execute(JRequest::getCmd('task'));
$controller->redirect();
?>

的manifest.xml 它包含代码目录结构和文件放置

<?xml version="1.0"?>
<!--
This file is used for writing all the extensions.
These files include the general installation information 
as well as parameters for the configuration of the extension itself.
-->
<extension type="component" version="3.4.5" method="upgrade">
  <name>com_openchat</name>
  <author>Manish Kumar</author>
  <version></version>
  <description>COM_OPENCHAT</description>
  <!--Include the media folder-->
  <media destination="com_openchat" folder="media">
    <folder>images</folder>
    <folder>css</folder>
    <folder>js</folder>
  </media>  
  <!--including the front end files-->
  <files folder ="components/com_openchat">
    <filename>myopenchat.php</filename>
    <filename>controller.php</filename>
    <filename>index.html</filename>
  </files>
  <languages folder="language/en-GB">
    <language tag="en-GB">en-GB.com_openchat.ini</language>
  </languages>
  <install>
    <sql>
      <file charset="utf8" driver="mysql">install.sql</file>
    </sql>
  </install>
  <update>
    <sql>
      <file charset="utf8" driver="mysql">update.sql</file>
    </sql>
  </update>
  <uninstall>
    <sql>
      <file charset="utf8" driver="mysql">uninstall.sql</file>
    </sql>
  </uninstall>
  <!--including the back end files-->
  <administration>
    <files folder ="administrator/components/com_openchat">
      <filename>myopenchat.php</filename>
      <filename>controller.php</filename>
      <filename>index.html</filename>
      <filename>install.sql</filename>
      <filename>update.sql</filename>
      <filename>uninstall.sql</filename>
    </files>
    <languages folder="administrator/language/en-GB">
      <language tag="en-GB">en-GB.com_openchat.ini</language>
      <language tag="en-GB">en-GB.com_openchat.sys.ini</language>
    </languages>    
    <menu link="option=com_openchat" img="media/images/chat_icon.png">COM_OPENCHAT</menu>
    <submenu>
      <menu link="option=com_openchat&amp;task=history" img="media/images/chat_history.png">COM_OPENCHAT_HISTORY</menu>
      <menu link="option=com_openchat&amp;task=blocked_user" img="media/images/blocked_user.png">COM_OPENCHAT_BLOCKED</menu>
    </submenu>
  </administration>
</extension>

当我点击Open Chat(菜单)时,在Joomla CMS的后端 - &gt;聊天记录(子菜单)。这给了我一个错误404组件找不到。

我的github存储库的路径是 https://github.com/mkumar85/openchat_Joomla/tree/master/com_openchat/administrator/components/com_openchat

问题似乎是控制器实现不正常。但我无法调试它。你能告诉我这里的编码问题吗?

0 个答案:

没有答案