Documentation

Features

Differences

This shows you the differences between the selected revision and the current version of the page.

development:modules 2008/08/25 10:56 development:modules 2009/07/29 11:21 current
Line 7: Line 7:
  - Each module must have a config.php file that includes needed information.   - Each module must have a config.php file that includes needed information.
  - The users should be able to activate and use the module from the "Modules" menu in the administrative. Optimally, a module should not require users to modify the source code.   - The users should be able to activate and use the module from the "Modules" menu in the administrative. Optimally, a module should not require users to modify the source code.
-  - If the module is going to interact with 68 Classifieds hook system it must contain a file mod_user.php and all functions must include the module name before the hook. For example: my_module_start() is a valid function name where start() is not. If you name your function incorrectly it will not cause problems except it will never be called through the script.+  - If the module is going to interact with 68 Classifieds hook system it must have a hooks.php file.
  - If needed inside the modules directory it can have a templates, language, and plugins directory. The templates directory would contain any template files needed. The language directory allows your module to work for multiple language. Please be careful not to name a language string the same as the standard language file. The plugins directory is to place any Smarty plugins that you would like to use for this module.   - If needed inside the modules directory it can have a templates, language, and plugins directory. The templates directory would contain any template files needed. The language directory allows your module to work for multiple language. Please be careful not to name a language string the same as the standard language file. The plugins directory is to place any Smarty plugins that you would like to use for this module.
  - index.php and admin.php and used if the module has a frontend area or an administration section. These are only required if the user needs to have some of interaction with the module.   - index.php and admin.php and used if the module has a frontend area or an administration section. These are only required if the user needs to have some of interaction with the module.
Line 25: Line 25:
==== Create a configuration file  ==== ==== Create a configuration file  ====
-We will need to create a new php file named config.php that will reside in the /modules/bad_words folder .+We will need to create a new php file named config.php that will reside in the /modules/customcats folder .
The config.php file should look like this: The config.php file should look like this:
Line 64: Line 64:
?> ?>
</code> </code>
 +
 +==== Creating a hooks.php file ====
 +
 +The hooks.php file is responsible for integrating functionality in the core of the script. Here is an example file:
 +<code php>
 +<?php
 + class customcats_events
 + {
 + function customcats_events(&$modules)
 + {
 + $modules->register('admin_tpl_layout_category', $this, 'admin_links');
 + }
 + function admin_links()
 + {
 + echo '<a href="modules.php?mod=customcats">Custom Cats</a>';
 + }
 + }
 +?>
 +</code>
 +
 +This code basically does two things. First in the constructor it registers the event you want and then when that hook is called it runs your method. In the example above we register admin_links to the admin_tpl_layout_category hook. Once this hook is called the admin_links method is ran. In this case it adds a new link to the admin navigation.
==== Creating an admin.php file ==== ==== Creating an admin.php file ====

Have more questions? Visit our community forums.