Joomla newbie module question
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开发者_如何学Go>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!';
}
}
?>
The module needs to registered in Joomla. Following are the ways to do it:
- Remove the folder from the modules directory. zip the files (using winzip for example). then upload & install it from joomla administration.
- Or, you can keep the folder in the modules directory and add an entry for this module in the database table 'jos_modules' (database prefix will be 'jos_' if you haven't changed it during installation)
精彩评论