Go Back   Pligg Forum > Pligg Help > Wiki Articles
 
 
LinkBack Article Tools Display Modes
  #1 (permalink)  
Old 09-22-2007, 04:55 PM
Yankidank's Avatar
Yankidank Yankidank is offline
Send a message via AIM to Yankidank Send a message via Skype™ to Yankidank
Pligg Founder
Pligg Version: SVN
Pligg Template: LemonTwist
 
Join Date: Dec 2005
Location: Ocala, FL
Posts: 1,544
Downloads: 65
Uploads: 6
Thanks: 100
Thanked 156 Times in 105 Posts
Building Modules

Reserved for future use.
Reply With Quote
Sponsored Links
Check out the New Templates at the Pligg Pro Shop.
  #2  

Building Modules

Modules
  Next Chapter »

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.

Modules
  Next Chapter »

Contributors:
Created by Yankidank, 09-22-2007 at 04:55 PM
Last edited by Yankidank, 09-22-2007 at 04:55 PM
1 Comments , 1153 Views
 



Article Tools
Display Modes
Posting Rules
You may not create new articles
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
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


LinkBacks Enabled by vBSEO 3.0.0