In-Portal Developers Guide

This is a wiki-based Developers Guide for In-Portal Open Source CMS. The purpose of this guide is to provide advanced users, web developers and programmers with documentation on how to expand, customize and improve the functionality and the code the In-Portal software. Please consider contributing to our documentation writing effort.

K4:Folder Structure

From In-Portal Developers Guide

Revision as of 23:30, 27 November 2010 by Dmitry (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search
Структура приложения Структура приложения
Статьи в этой категории

Projects written using K4 have a module-based structure. Each module is a directory in the root directory of the site. All modules have the same sub-directory structure, as described below:

name description
module/admin_templates Directory that contains module templates used for the administrative console.
module/admin_templates/img Directory that contains images used by the module.
module/admin_templates/img/icons Directory where the icons used in the left tree menu and above grids in the administrative console are located. The specifics about how the files in this directory should be named are written here.
module/admin_templates/img/itemicons The directory which contains the icons that are show next to each record in the list of records (only for In-Portal). The names of the files in this directory must start with the prefix "icon16_" and follow naming convention rules.
module/admin_templates/img/toolbar This directory contains icons for each button in the toolbar, which is unique to each module. How to name icons used in the toolbar is written here.
module/install This directory contains files used for installation of the specific module.
module/units Directory that contains PHP code.


The following abbreviations will be used below:

prefix - prefix of unit config in singular form, for example, event (singular because of rules of the English language)
prefixx - prefix from the unity config, only plural
helper - class helper (child of class kHelper)

Location of Files

  • a directory is created for each prefix prefixx (for example themes)
  • this directory must contain, minimally, one file - <directory_name>_config.php, which is the unit config
  • all other files in the directory are named corresponding to file naming conventions
  • also, in the units directory of the module, it's allowed to create two independent directories helpers and sections. All the independent helpers (i.e. those with which more than one config may work) should be put in the helpers directory. All classes that are replacing other classes must be put in the sections directory. Correspondingly, unit configs must be created (or copied from another project) for both directories.
  • in the root directory of the module (for example, custom) a file can be created called constants.php, in which all constants necessary for the project can be placed.

Which files can be changed

Files can be changed only in the following directories:

  • files in the directory of the module "custom" (all code specific to the project)
    <project_name>/custom
  • files in the directory for the Front-End theme
    <project_name>/themes/theme_<project_name>
Image:Infobox Icon.gif Changing and committing files in other directories is prohibited

In some cases there are exceptions to the above rules, for example when

  • the required functionality can't be realized without changes to K4 files
  • a partial upgrade is being done for a project (to saved time), in which case all other files can be changed, but with care, and with permission of your management

Translated from: K4:Структура директорий (revision 1066)