| | LinkBack | Article Tools | Display Modes |
| Sponsored Links |
|
Check out the New Templates at the Pligg Pro Shop.
|
|
#2
Building Modules | ||||||||||
Credit to Cent for this information: modulename_init.php - loads the modulename_settings.php file which has all of the definitions. - include_in_pages is an array with all of the pagename(s) the module should work in. - do_not_include_in_pages is an array of pagename(s) the module should not work in. include_in_pages can be ('all') and do_not_include_in_pages can be ('submit') which makes life pretty easy. - module_add_action('external_name', 'internal_function_name', 'variables')... whereas external_name is the name placed in .tpl files such as check_actions('external_name'). internal_function_name is the name of the php function that should be triggered in the modulename_main.php file. - include_once(mnmodules . "moduledirectory/modulename_main.php) just loads all of the PHP functions for the module. modulename_install.php - module_info['name'] is the name of the module for the module manager - module_info['desc'] is the description - module_info['version'] is the version number - [i]module_info['requires'][] is an array of any dependent modules required (pass/fail) modulename_main.php There are PHP functions which are called, when needed, from various templates. You will need to declare globals for certain variables that you will need access to outside of the function like $db (for the database), $smarty and $main_smarty (for smarty variables -- to set or retrieve values) and any other variables as well like $linkres (if needed). modulename_readme.htm The module's readme file. I've been trying to make them easier to understand and with step by step instructions for installation and configuration. modulename_settings.php Here is where you define all of your module's variables. - define('modulename_path', '') - path to your module - define('modulename_plugins_path', '') - path to plugins your module uses (if necessary) There is also a section called if(is_object($main_smarty)) which allows you to send variable definitions back to smarty. I used them in the imageupload module, but I dont actually use them. However, I can see how they could be pretty powerful as it allows you to send back variables called set from within the module itself. That's pretty much all I know. I believe module_add_action_tpl would in some way allow you to include say an HTML form within a template. Like, I believe I could have used it to automatically include the "Select JPG file" file attachment using the module instead of having to use enable_extra_fields. This would allow people to turn off the module, and essentially turn off the ability to upload image file with an entry. As it stands now, if you turn off the module, the form fields are still present even though they don't actually do anything.
| ||||||||||
« previous article
|
next article »
| Article Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Keeping sidebar modules hidden/expanded | elquiosco | General Help | 1 | 10-13-2007 03:38 AM |
| Can not see RSS Importer or other modules | pligger456 | Installation and Upgrade Help | 2 | 09-17-2007 08:11 PM |
| Minimized Sidebar Modules | Jake | "Digital Nature" | 0 | 09-05-2007 09:23 PM |
| Modules and RSS importer do not work after upgrade to 9.6 from 9.5 | altinvest | Installation and Upgrade Help | 0 | 06-04-2007 12:20 PM |
| Building modules 101 | revolver | Pligg Mods | 1 | 05-23-2007 10:40 PM |




Linear Mode

