Perfecto CMS - Content management system
  • Русский язык
  • English version
Sign in
Create an account
PerfectoCMS Documentation
PerfectoCMS Documentation
You can find best practices on all major configuration procedures that will help you plan better your resources and environment.

Module development

5,030 views / 16 Jan 2015 edited
Perfecto CMS is very flexible, convenient and customizable to your needs content management system. Our structure quickly allows third-party developers to create individual modules for system. This page contain information about module development.

Module structure

MODULE_NAME # this is your module name in this document
LANG_NAME # this is an active language in this document

./modules/frontend/ # path to the website modules folder
./modules/backend/ # path to the control panel modules folder
./templates/frontend/default/ # website templates path
./templates/backend/default/ # control panel templates path
./languages/LANG_NAME/frontend/ # website language variables path
./languages/LANG_NAME/backend/ # control panel language variables path

Module development

  • 1. Template file (design)
    Please, create a 4 template file. First two is an website templates and last two for control panel templates
    # module main template, which is displayed only on the page module
    # module global template, which appears on any page of the site
    # data list template in control panel
    # edit, create action template in control panel
    Template file extension is *.tpl
  • 2. Handler files
    Please, create a 4 PHP files. First two is an website handler and last two for control panel handler.
    # module main handler, which is handled exclusively on the page module
    # module global handler, which is handled on any page of the website
    # data list handler in control panel
    # action handler in control panel
  • 3. Language variables
    Please, create 2 files for language variables
    # language variables for website section
    # language variables for control panel section
    Please note! If you have a multilingual site, you need to create language files for each language.
    Language variables files extension is *.lng and have the following syntax:
    			< ?
    $lang = array (
    'key_first' => "First value",
    'key_second' => "Second value",
    'anyword' => "Other value"

    /* an infinite number of variables here */

  • 4. Module integration
    4.1 identification
    To identify the module, you need to lower the specified query to the database:
    -- MODULE_NAME - your module name, identical with the name MODULE_NAME
    -- MODULE_DESCRIPTION - your description
    -- AUTHOR - your name
    -- AUTHOR_SITE - your website url
    -- VERSION - module version
    -- TIME - creation date
    -- CATEGORY - 0: If your module does not require integration with categories or 1: if integration is required
    INSERT INTO `modules` (`name`, `title`, `text`, `author`, `author_site`, `version`, `date`, `type`, `category`, `status`)
    4.2 in control panel section
    Please login into the control panel, and go to «Users» → «Groups». You must edit each group, placing a check on the resolution of rights of access to the new module.
    4.3 in website section
    You have two ways to connect new module: {#mod.MODULE_NAME} or {#mod_global.MODULE_NAME.block}
    To connect you must open ./templates/frontend/default/index.tpl file and place one or more methods above.
    Let's say your module is named: «bestmod», you need to connect it through: {#mod.bestmod}
    If desired, you can connect module globally: {#mod_global.bestmod.block}.
  • 5. Display «Hello World»
    Let's display our favorite phrase «Hello World».
    So, open the file you created ./modules/frontend/MODULE_NAME/module.php and write the following code:
    			< ?
    # ----------------------------
    # Module important headers
    # ----------------------------
    if (!defined('PERFECTOCMS')) {
    die ("Access denied!");
    $assign = "module_name";
    $template[$assign] = $assign.".tpl";

    /* start your code */

    $tpl->assign('firstvar', 'Hello world!'); # assign Hello World to the firstvar var

    /* end of your code */

    # ------------------------------------
    # generate and display module template
    # ------------------------------------
    After you must write variable in the template file. Please open ./templates/frontend/default/MODULE_NAME.tpl and write following code in any place:
  • 6. Module URL
    New module will be available at: ./index.php?module=MODULE_NAME
    You can create a directive in .htaccess file, following example:
    			# MY MODULE
    RewriteRule ^([a-z])?/?MODULE_NAME/?$ index.php?lng=$1&module=MODULE_NAME [L,QSA]
    RewriteRule ^([a-z])?/?MODULE_NAME/page/([0-9]+)/?$ index.php?lng=$1&module=MODULE_NAME&page=$2 [L,QSA]
    And module will be available at: ./MODULE_NAME/

Ready example

You can download the completed module sample for Perfecto CMS.
Website design order
Unique offer for customers of Perfecto CMS.
If you want an original design let us know and we will contact you to discuss the details.
Please note
We appreciate your time and for save time, please download the blank of design order, complete it and send to our mailbox: Our email
Approximate price
600 USD

Your browser is out of date!

Please download the latest version of Internet Explorer
We recommend to use another modern browser!