User Tools

Site Tools


  Main   About   Help   Download

Sidebar

nconf:help:documentation:modules:main

Modules

The NConf modules provides some optional functionality.

With a collection of shared functions user could also make their own modules, or expand some existing functionalities.

Here is a list of modules for NConf

At the moment there is only the deployment module

Deployment

This module provides you with some deployment possibilities.


Module development

Design

Location

All modules are located in this directory:

nconf/include/modules/

Content

Each module must have a init.php file, which will be loaded by NConf automatically. This file will be loaded on every page, so normaly there are just some configurations inside.

  • This should not contain configurations for users!

users configuration file

Provides the module some configuration possibilities for users, this should be placed in the

nconf/config/

by the user itself

Its name should be the module name and the ending ”.ini” (#modulname#.ini)

for example for the module “deployment”:

nconf/config/deployment.ini

It should be in the INI format, which is documented on php.net (http://php.net/manual/en/function.parse-ini-file.php) So you can import the config into an array.

module types

There are different types of how the module is integrated into NConf. This depends on the provided functionality of the module.

not yet defined…

module itself

The main file of a module should contain at least the following lines, to fit correct into NConf:

example_main.php
<?php
    require_once('config/main.php');
    require_once(NCONFDIR.'/include/head.php');
 
    // put your code here....
 
    require_once 'include/foot.php';
?>

This will give you the layout and the functionality to easily interact with NConf.

NConf modules API

There are some Interfaces which could help you in creating or printing content. You can create your own output with html content, or you can use the NConf::HTML class.

NConf::HTML

This class will give you the possibility to print things out.

The class gives you some “standardized” outputs. for example:

  • title
  • text
  • tables
  • swap'able content (expand some information)

the detailed documentation will be made using doxgen or something like this.

Here are some examples.

// some text
echo NConf_HTML::text('text...', TRUE, 'div', 'class="attention"');
 
// print a title
echo NConf_HTML::title("this is a title");
 
// print a horizontal line
NConf_HTML::table_row_text(NConf_HTML::line());

NConf::DEBUG

The DEBUG class helps you put some information into the “debug console”.

to show the debug information, you must enable “DEBUG_MODE”.

In NConf we recommend you to only do this when developing a module or analyzing a problem/bug

NConf_DEBUG::set

Text / Values
function set($MESSAGE, $LEVEL = "DEBUG", $TITLE = '')
// set a text into degug:
NConf_DEBUG::set('some '.$simple.' text');
 
// set also a title and debug level
NConf_DEBUG::set("message... perhaps with $some_var ", 'DEBUG', "a title");
 
// example from the loading module :
NConf_DEBUG::set("$module_name loaded", 'DEBUG', 'Module');
Arrays

To print an array, you can just set the array into it. The debugger will display a “print_r” of the array (swap)

NConf_DEBUG::set($array, 'DEBUG', "title for printing the array");

upcoming / to do's

  • how to make a new module

AUTHOR

Written by Fabian Gander

nconf/help/documentation/modules/main.txt · Last modified: 10.12.2011 14:03 by agargiulo