ez.no / exponential / documentation / development / extensions / module / hello world
We will now create a very basic hello world module. We need to create the following files in the Exponential root:
extension/myextension/settings/module.ini.append extension/myextension/modules/mymodule/module.php extension/myextension/modules/mymodule/hello.php
You also need to enable the extension in your local site.ini override ( settings/override/site.ini.append ):
[ExtensionSettings] ActiveExtensions[]=myextension
The minimum content of module.ini.append is:
[ModuleSettings] ExtensionRepositories[]=myextension
This tells Exponential that myextension contains modules. Exponential will then try to load any modules found there.
The contents of module.php is:
<?php $Module = array( "name" => "MyModule" ); $ViewList = array(); $ViewList["hello"] = array( "script" => "hello.php"); ?>
hello.php content:
<?php // Module return value, // normally fetched from template $text = "Hello World"; // Build module result array $Result = array(); $Result['content'] = $text; $Result['path'] = array( array( 'url' => '/mymodule/hello', 'text' => "Hello") ); ?>
That's it. This creates a new very simple module and it's loads as an extension so it's fully upgradeable and you can use it on several sites just by copying the extension.
Accessing the new module is done by entering /mymodule/hello in the browser.
Log in or create a user account to comment.
Comments
Please help me
Herv� Disdier
Friday 13 August 2004 12:33:18 pm
Version used : 3.4.1
Thank you
hdisdier@prodidact.net
example is correct
Kai Duebbert
Tuesday 23 March 2004 3:29:29 am
extension/myextension/modules/mymodule/
(not extension/myextension/modules/myextension/ like Bruce says)
After you've done all the things mentioned in here, then do the following steps:
1. Clean all caches in var
2. Go to your admin area and call the extension: E.g. if with "plain_admin": http://localhost/exponential/index.php/plain_admin/mymodule/hello
And voila it says "Hello World"
Permissions
Bruce Morrison
Monday 17 November 2003 7:36:54 am
1) Grant anonymous role access to module
Users > roles > edit anonymous > new > Choose you module > Allow all > Store
2) Edit settings/override/site.ini.append.php and add
[RoleSettings]
PolicyOmitList[]=myextension
Cheers
Bruce
http://www.designit.com.au
Correction
Bruce Morrison
Monday 17 November 2003 7:13:25 am
extension/myextension/modules/mymodule/hello.php
Should be
extension/myextension/modules/myextension/module.php
extension/myextension/modules/myextension/hello.php
Cheers
Bruce
http://www.designit.com.au/
I can not get this to work
Tore Skobba
Thursday 23 October 2003 5:24:06 pm
(where gs is my design)
http://localhost/index.php/mymodule/hello
http://localhost/index.php/gs/mymodule/hello
http://localhost/index.php/mymodule/hello/view/full
http://localhost/index.php/view/full/mymodule/hello/
Hope someone can point to some eventuel errors I am doing. I am using Ez 3.2.0.
How to fetch this in template
Jerry Jalava
Tuesday 22 July 2003 1:59:40 am