Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dev:module_convention [2008/06/25 16:02]
richard
dev:module_convention [2010/01/06 20:56] (current)
Line 33: Line 33:
  
   * **inst/setup.inc** (optional) - A setup script beyond the MySQL database creation for module installation. This is automatically used by the web installer or the package installer. The basic version will have the package version and details, whist the advanced form of this script will have installation, upgrade and uninstallation functions   * **inst/setup.inc** (optional) - A setup script beyond the MySQL database creation for module installation. This is automatically used by the web installer or the package installer. The basic version will have the package version and details, whist the advanced form of this script will have installation, upgrade and uninstallation functions
- 
- 
 ===== Main Module Skeleton and Convention ===== ===== Main Module Skeleton and Convention =====
 As mentioned earlier Sahana dynamic plugin architecture is based on certain naming conventions of files and functions.  As mentioned earlier Sahana dynamic plugin architecture is based on certain naming conventions of files and functions. 
Line 41: Line 39:
  
 1. decide on a name unique to it amongst modules, (lets say myapp) 1. decide on a name unique to it amongst modules, (lets say myapp)
-2. create a directory called myapp in the /mod + 
 +2. make sure your module's name conforms to these requirements: http://wiki.sahana.lk/doku.php/dev:php_coding_convention#choosing_a_name_for_a_module_in_sahana_module 
 + 
 +3. create a directory called myapp in the /mod 
  
   mkdir -p mod/myapp   mkdir -p mod/myapp
  
-3. Add the following files as required above+4. Add the following files as required above
 ration variables  ration variables 
  
-4. Add the default function for main.inc+5. Add the default function for main.inc
  
 <code> <code>
Line 106: Line 107:
   admin function prefix:     shn_or_adm   admin function prefix:     shn_or_adm
   default admin function:    shn_or_adm_default()   default admin function:    shn_or_adm_default()
 +
  
  
 ===== conf.inc ===== ===== conf.inc =====
-The conf.inc file is used for a few purposes. Please do not add you other module specific configurations into this as all conf.inc files included for every HTTP request. The primary use of the conf.inc is to provide a nice name and display order for your module in the main menu. The two variable set for this are $conf['mod_'.<mod>.'_name'] and $conf['mod_'.<mod>.'_menuorder'], wheer <mod> is the directory of your module.+The conf.inc file is used for a few purposes. Please do not add you other module specific configurations into this as all conf.inc files included for every HTTP request. The primary use of the conf.inc is to provide a nice name and display order for your module in the main menu. The two variable set for this are $conf['mod_'.<mod>.'_name'] and $conf['mod_'.<mod>.'_menuorder'], where <mod> is the directory of your module.
  
 Typical usage is as follows Typical usage is as follows
Line 162: Line 164:
  
 As Sahana becomes more integrated you may find yourself referencing and even creating data in tables belonging to other modules. For example adding an item in your module to the gis. Remember that it is your responsibility to clean up after yourself. So remember to use the aproprate **Create Modify** and **Delete** interfaces in other modules so as not to leave residual/incorect references lying around in the system. As Sahana becomes more integrated you may find yourself referencing and even creating data in tables belonging to other modules. For example adding an item in your module to the gis. Remember that it is your responsibility to clean up after yourself. So remember to use the aproprate **Create Modify** and **Delete** interfaces in other modules so as not to leave residual/incorect references lying around in the system.
- 
- 
- 

Navigation
QR Code
QR Code dev:module_convention (generated for current page)