Joomla新手模块问题
我的任务是为 joomla 网站创建一些模块,但我没有 joomla 的经验(典型的,右)。不管怎样,在排便和振动装置相遇之前我还有一些时间,所以我熟悉了 joomla。我正在关注 joomla 网站上提供的 mod_helloworld 教程,但该模块没有显示在扩展管理器中。任何帮助/解释将不胜感激。
这就是我所做的:
在modules目录中创建一个mod_hellworld目录,添加一个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>
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!';
}
}
?>
I'm being tasked with creating some modules for a joomla site but I have no experience with joomla (typical, right). Anyway I've got some time before defecation and oscillating device meet so I familiarizing myself with joomla. I was following the mod_helloworld tutorial available on the joomla site but the module is not showing up in the extensions manager. Any help/explanations would be appreciated.
This is what I did:
create a mod_hellworld directory in the modules directory, added a mod_helloworld.php, helper.php, mod_helloworld.xml, a tmpl directory and placed default.php file in there.
Here's the XML file.
<?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>
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!';
}
}
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该模块需要在 Joomla 中注册。以下是执行此操作的方法:
The module needs to registered in Joomla. Following are the ways to do it: