container.inc is just a container for other includes. It was introduced to package all includes into one file. All the includes which are in the container.inc dont have other includes itself. This mean there are only 2 include levels, the first is the container.inc and the second level are the includes inside container.inc. There is no 3. level. Below the content of container.inc:
<?php /* $Id: coding_addmodule.xml,v 1.5 2003/03/14 14:24:58 k-fish Exp $ */ require_once(SMARTY_DIR . "Smarty.class.php"); // definition of moregroupware class, holding application vars include(INCLUDEPATH . 'mgw.class.inc'); // functions for translation include(INCLUDEPATH . 'lang.inc'); // array for tracking file revision number used in sql error report screen $Revisions_array = Array(); // important functions like connect to database include(INCLUDEPATH . 'userfunc.inc'); // definition of moregroupware version and label include(INCLUDEPATH . 'version.inc'); // Auto-Assigns for template engine and global definitions include(INCLUDEPATH . 'appconfig.inc'); // include module specific functions if present (they are now in module/inc) // must be named module_func.inc.php (i.e. calendar_func.inc.php) if(file_exists(ROOTPATH . "/modules/" . $myEnv["module"]. "/inc/" . $myEnv["module"] . "_func.inc.php")) { include(ROOTPATH . "/modules/" . $myEnv["module"] . "/inc/" . $myEnv["module"] . "_func.inc.php"); } // help system if(file_exists(ROOTPATH."/modules/".$myEnv["module"]."/help/index.".$MGW->spkz.".html")) $smarty->assign("helpurl", $myEnv["module"]."/help/index.".$MGW->spkz.".html"); elseif(file_exists(ROOTPATH."/modules/".$myEnv["module"]."/help/index.en.html")) $smarty->assign("helpurl", $myEnv["module"]."/help/index.en.html"); elseif(file_exists(ROOTPATH."/modules/general/help/index.".$MGW->spkz.".html")) $smarty->assign("helpurl","general/help/nohelp.".$MGW->spkz.".html"); else $smarty->assign("helpurl","general/help/nohelp.en.html"); // include module autoexecution of several things like translation, authentication, and more include(INCLUDEPATH . 'module_exec.inc'); ?>
In the next sections, we show the meanings of each include.
This include loads the smarty classes which will be used by other includes (appconf.inc) and of course by the user scripts. Without this include, there wont be any output at all.
The MGW class will be stored in the user session in form of an object. This object holds many user related data such as languagecode, username or his current rights. We use this object for checking various things, without being forced to make any database queries. You will learn how to use this class later on, because its very important for your module.
This include provides the language functions which we need also in appconf.inc and sometimes in the userscripts.
This is the place where we store system wide useful functions. These are functions which could useful in each module. Dont place functionalities for specialized module tasks in there.
This is the most simple include, the version.inc only contains the release number and the name of the product, this will be displayed in some places inside the groupware. See bottom status bar for example in each screen.
This is the most complex include, it does various things, below is a list of things which are important to know as a programmer:
creation of $appconf["gentemplates"], this points to the general/templates/html folder, this will be used for including html fragment from the general folder, instead of the current module template folder, within the template you can reach this variable with {$gentemplates}
creation of $appconf["imgpath"] and $appconf["imgpathgeneral"], this point to the module image path or to the general image path (name of folder is "media"). You will need this variables inside templates. You can reach them with {$imgpath} or {$imgpathgeneral} inside templates.
creation of $smarty object, this object you will use to program the output of your module, you will most likely use methods like $smarty->assign(), $smarty->append() and $smarty->display().
the session will be started in this include
following templates variables will be auto-created and should be used in the templates: {$PHPSESSID} (actual session id of user), {$rooturl}, {$username}, {$userfullname}, {$phpself}, {$gwversion}, {$gwtitle}. If you dont know some meaning, just insert them in your template, you will see what is being thrown out :)
creation of main-menu