""
Documentation daCode : daCode webmaster's guide
Chapitre 6. daCode's extension (experimental)

 

Writing of an extension

 

The necessary files

An extension is made of at least a directory containing library files (declaring or overloading classes). This directory is called lib/. You have complete control over the rest. It may convenient to define a directory holding all publicly accessible files (named doc/ here) .

The following files must be found in the lib/ directory:

  • config.php3: the configuration for your module, written the same way as the main daCode configuration file. Please take care not to overload parameters defined in other extensions.

  • config.internals: the config of the guts of your module, which must be hidden to the casual user. Generally speaking, everything about the coupling of your module with daCode. Declaration of class overloads shall be here.

  • include.php3: the file to be included. Filenames must be in the form $libdir . $path . "file_name_without_extension." . $this->php . Be cautious: the filename must end with a dot, as $this->php holds the PHP extension without the dot. Also $libdir and $path are system variables daCode determines and uses to find the files; they must be present as shown in the filename.



 

Overloading of daCode's standard classes

To substitute some basic daCode class by one of your extension, you have to indicate in the $config->overloads parameter the the base class is replaced by yours. Remember, some extensions may also use this parameter, as may the user (in case of conflicts with PHPLib, for instance).

Here's an exemple to substitute daCode News class with the Test class you just wrote. That shall be in config.internals:


    $this->overloads["News"] = "Test";