Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Module Joomla新手模块问题_Module_Joomla - Fatal编程技术网

Module Joomla新手模块问题

Module Joomla新手模块问题,module,joomla,Module,Joomla,我的任务是为joomla站点创建一些模块,但我没有joomla的经验(典型,对)。无论如何,在排便和振荡装置见面之前,我还有一些时间,所以我要熟悉joomla。我一直在关注joomla站点上提供的mod_helloworld教程,但是扩展管理器中没有显示该模块。如有任何帮助/解释,将不胜感激 这就是我所做的: 在modules目录中创建mod_helloworld目录,添加mod_helloworld.php、helper.php、mod_helloworld.xml和tmpl目录,并在其中放置

我的任务是为joomla站点创建一些模块,但我没有joomla的经验(典型,对)。无论如何,在排便和振荡装置见面之前,我还有一些时间,所以我要熟悉joomla。我一直在关注joomla站点上提供的mod_helloworld教程,但是扩展管理器中没有显示该模块。如有任何帮助/解释,将不胜感激

这就是我所做的:

在modules目录中创建mod_helloworld目录,添加mod_helloworld.php、helper.php、mod_helloworld.xml和tmpl目录,并在其中放置default.php文件

这是XML文件

<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="1.6.0" client="site" method="upgrade">
    <name>Hello World!</name>
    <author>Steve Suranie</author>
    <version>1.6.0</version>
    <description>Simple Hello World module.</description>
    <files>
        <filename module="mod_helloworld">mod_helloworld.php</filename>
        <filename>mod_helloworld.xml</filename>
        <filename>index.html</filename>
        <filename>helper.php</filename>
        <filename>tmpl/default.php</filename>
        <filename>tmpl/index.html</filename>
    </files>
</extension>

你好,世界!
史蒂夫·苏拉尼
1.6.0
简单的helloworld模块。
mod_helloworld.php
mod_helloworld.xml
index.html
helper.php
tmpl/default.php
tmpl/index.html
mod_helloworld.php

<?php
  defined('_JEXEC') or die; // no direct access allowed

  require_once dirname(__FILE__).DS.'helper.php'; // get helper files

  $hello = modHelloWorldHelper::getHello($params);
  require JModuleHelper::getLayoutPath('mod_helloworld');
 ?>

helper.php

 <?php
class modHelloWorldHelper {
    /**
     * Retrieves the hello message
     *
     * @param array $params An object containing the module parameters
     * @access public
     */    
    function getHello( $params ) {
        return 'Hello, World!';
    }
}
?>

模块需要在Joomla中注册。以下是执行此操作的方法:

  • 从模块目录中删除该文件夹。压缩文件(例如使用winzip)。然后从joomla administration上传并安装它
  • 或者,您可以将文件夹保留在modules目录中,并在数据库表“jos_modules”中为此模块添加一个条目(如果在安装过程中没有更改,则数据库前缀将为“jos_”)