|
Decoders and Modules
|
|||||||||||||||||
Decoders and ModulesIn this page, we discuss the way to extend CCMS with the help of providing new decoders and modules. Besides reading this page, you may want to observe the folders. CCMS comes with a few prebuilt modules. DecodersDecoders are placed in /decoder folder with function name of ccms_decoder_DecoderName. Also, global array variable $ccms_decoders should contain such an entry. For example, decoder gallery has filename of /decoder/gallery.php with function name of ccms_decoder_gallery, also "gallery" inside $ccms_decoders. When a path is given by user from the URL, CCMS checks if there are any files with extension the same as a decoder. For example, Rebecca.gallery will be decoded as a gallery and "About_me.html" will be decoded as a html document. Note that there is at most one decoder call per page request. When no suitable decoder is found, CCMS continues to see if the MIME of the file extension (global map variable $ccms_mime) is defined. If yes, the file will be downloaded plainly. Otherwise access denied will be given. This is a feature to protect against accessing some sensitive-content files. Decoder is given one parameter when it is executed - file. Besides, there are a few global variables to access in order to finish decoding process. Indeed, decoder function does not need to return anything. These processes include
ModulesModules are placed in /module folder with function name of ccms_module_ModuleName. For example, module navigation has filename of /module/navigation.php with function name of ccms_module_navigation. Location of modules can be configured by placing module names into one or more of the global array variables $ccms_left_modules, $ccms_right_modules, $ccms_top_modules and $ccms_bottom_modules. These variables can be modified on the fly while decoder is running. Modules are given one parameter when it is executed - file. Similar to decoders, modules can access the global variables. Please see the table in Decoders section for insights. Modifying them is however less recommended as a few modules may interfere each others if they change these parameters altogether. Modules are expected to return a value to notify caller result of execution. There are three modes of return values for different situations.
|
||||||||||||||||||
Powered by Charray's CMS.