Share » Forums » Developer » Writing new modules

Writing new modules

Writing new modules

Thursday 12 June 2003 2:18:05 am - 7 replies

Modified on Thursday 12 June 2003 3:20:50 am by Tristan Koen

Author Message

Sven Ryen

Thursday 12 June 2003 6:48:53 am

Hi Tristan!

We're in the same boat, it seems... I just started looking into modules today.

The file:
    /lib/ezutils/classes/ezmodule.php
should provide you with info on how modules are executed.

Please post your findings here. I promise to do the same.

Sven Ryen

Thursday 12 June 2003 7:48:32 am

FWIW, I think the reccomended way of adding a module is to add an entry to either ModuleRepositories[] or ExtensionRepositories[] under [ModuleSettings] in module.ini.append.

Then, place your modules in the folder you add to ModuleRepositories[] or in a "modules/" subfolder inside the folder you add to ExtensionRepositories[].

So, if you need to add a module named "bar", you could add the file:
   /foo/modules/bar/module.php
and add "ExtensionRepositories[]=foo" to the file
   /settings/override/modules.ini.append

Sven Ryen

Thursday 12 June 2003 8:43:20 am

Note that some modules also have functions and operations, which are ? respectively ? defined in the files
    /kernel/<module_name>/function_definition.php
and
    /kernel/<module_name>/operation_definition.php

The functions and operations are executed by the files:
    /lib/ezutils/classes/ezmodulefunctioninfo.php
    /lib/ezutils/classes/ezmoduleoperationinfo.php

Sergiy Pushchin

Thursday 12 June 2003 11:19:56 am

1. You are right.
2. Yes you are right.
ViewList is set of views defined for module, for each view you define:
'functions' - to which functions user should have access to to be able to execute this view. so it used for permission system.
'default_navigation_part' - navigation part which should be active when this view is executed.
'single_post_functions' and 'post_action_parameters' is a mapping between post variables (buttons, input fields) and actions inside view.
'script' - php file which should be executed when user acceses this view.
'params' - params in url. for example url is 'content/edit/29658/1', content is modeule name, edit is view name and the last two numbers will be interpreted as parameters for the view.
"params" => array( "ObjectID", "EditVersion", 'EditLanguage' )
So inside a view you will be able to access
$Params["ObjectID"]; and $Params["EditVersion"]; they will get values 29658 and 1 by order. $Params["EditLanguage"]; will be empty since in url we have only two parts after view name separated with '/'
3.You are right.

about these two lines
$http =& eZHTTPTool::instance();
If you don't use it, it is not nessesary to put this line in view file

$Module =& $Params["Module"];
The same with this one. $Module object you get in this line gives you a lot of control on execution. For example you can use http redirections using its methods.

 

Sven Ryen

Thursday 12 June 2003 11:49:26 am

There's also documentation on module handling here:

http://www.ez.no/sdk/ezutils/view/module_handling/

Bruce Morrison

Thursday 12 June 2003 4:19:46 pm

Will someone from eZ please correct me if I'm wrong, but the proper way to add modules is via the extention system. This way you do not have to modify any ezpublish code only the configuration files. Upgrades a whole lot simpler if you use this method!

I looked at the ezRSS and glossary contributions as well as the online editor which all work this way and used these to create my own modules as extentions. These examples proved invaluable.

Cheers
Bruce
designIT

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Sven Ryen

Friday 13 June 2003 1:33:49 am

Ineed.

Extensions allows you to gather actions, datatypes, design, eventtypes, modules, settings and probably more in one convenient folder, improving portability and upgradability.

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu