Installing, Modules

Installing codkep

Before you start, make sure your web server is running and php enabled.
The CodKep requires at least PHP 5.4.0 version.

To install the CodKep you only need to do is download the CodKep sources and extract to your webserver's root.

# In case the webserver's root is /var/www/html
$sudo tar xzvf codkep-XYZ.tar.gz -C /var/www/html

If the php is enabled on your web server, you can reach your website. You should see the start page of CodKep.


On the start page the CodKep will check some dependencies and prerequisites. Please install/do the necessary things to your system to correctly use the framework.

In order to create your own site with CodKep you have to create the following two files, which holds the settings of the new site.

site/_settings.phpThe global settings of your site is done here.
(This settings are expandable by modules)
site/_modules.phpThe modules of your site. You can enable disable your own modules in this file.

See the Site settings, configuration chapter to learn how to create _settings.php. Thereafter read the modules chapter to create _modules.php.


The following files and directories are exist in CodKep (webserver root after installing).

namepurposein case of upgrade
dataContains the file data of the site executed by the frameworkDoes not need to touch this directory
siteContains your site settings, and custom modules written by the site builders.Does not need to touch this directory
sysCodKep core files with core modules.
No need to change anything here when build your own site.
This directory should fully overwrite
index.phpSymbolic link to sys/index.php
This is the entry point of the site.
Does not need to touch this link
because the real file is ugraded in sys directory

CodKep upgrade: All CodKep core files are located under sys directory, so in case of upgrade you only need to rewrtite the whole sys with the upgraded version and leave other directories untouched.

Site settings, configuration

Every settings and modules belongs to your site is located in site directory.
The is two special file located in site which contains important settings of your site.

Let's see an example of site/_settings.php contains some important info to set. This code can be used as start template for new site.

global $site_config;

//Change this in case if CodKep does not installed to webserver root
$site_config->base_path = '';
 // $site_config->base_path = '/mysite';
 // $site_config->base_path = '/~paul/web';

//Specify the internal location started when non requested (startpage)
$site_config->startpage_location = 'start';

//Specify your own page theme if you have one.
//$site_config->default_theme_name = 'flex';

$site_config->site_name    = "CodKep site";
$site_config->site_slogan  = NULL;

//Your site's favorite icon
//$site_config->site_icon = '/data/images/siteicon.ico';

//Default locale of the site
//$site_config->lang = '';

//Enable or disable page generation time below the generated content.
$site_config->show_generation_time = true;

//Enable clean urls.
// (Example:  -> )
//Need some further settings in webserver to enable this. See clean url section in doc.
//By default it is false.
$site_config->clean_urls = false;

//Enable/disable your site hook table info.
//$site_config->enable_hook_table_info = true;

The sql database settings of the site is also come here:

global $db;

//Settings of the sql database
$db->servertype = "mysql";
$db->host       = "";
$db->name       = "databasename";
$db->user       = "username";
$db->password   = "secretpassword";

//You can specify a password for sql schema editor page here.
//The editor can reached with this password in case no admin user logged in.
//You can disable this by set empty password.
$db->schema_editor_password = "VerySecretPassword";

global $site_config;

//Some debug functionality. Prints all sql command to the page end.
//$site_config->show_sql_commands_executed = true;

The system modules have many settings can be set this way. I won't list all of then, but let see some important here:

$site_config->base_path core '' Installed location relative to the root of webserver. Leave empty if installed to domain's root. Start with "/" sign if specified. For example: "/mysite"
$site_config->base_path_nonexfiles core NULL Overrided location of static files like images, documents etc.
$site_config->startpage_location core 'not_configured_startpage'Default start location of the page
$site_config->startpage_location_byhost core array() Default start location of pages for different domain names. Associative array of domain names and locations
$site_config->default_theme_name core 'flex' The default page theme (style) name of the site. The internal locations can override this.
$site_config->site_icon core 'sys/images/cklogo.ico' The default favicon of the site. The sub-locations can override this.
$site_config->notfound_location core 'notfound' The "page not found" location of the page. If a non existent location is requested it will be redirected to here.
$site_config->lang core 'en' The default language locale of the site
$site_config->site_name core NULL The name of the site. (NULL if not defined)
$site_config->site_slogan core NULL The slogan of the site. (NULL if not defined)
$site_config->logo_img_url core NULL The url of the logo image displayed on page top. (NULL if not defined)
$site_config->mainmenu core array() The main menu structure of the site. It contains "menu item name"=>"menu item location" pairs. And also can contains sub-arrays. The generate_menu_structure() will generate the output according to this value.
$site_config->mainmenu_append_tag_mainmenu core true If this value is true the CodKep will append all route with #mainmenu tag to the $site_config->mainmenu array with the appropriate hash value as menu name.
$site_config->cookie_domain core NULL Set the domain of session cookie name. You can enable cross site login with specify this name to same value.
$site_config->authcookie_name_salt core random value A random salt value to generate authcookie name. The security is improved, when changed to some random data.
$site_config->show_generation_time core true Enable or disable page generation time info. (Bottom of the page)
$site_config->main_script core 'index.php' Main "entry point" of the codkep system. This used when a local url generated
$site_config->clean_urls core false Enable clean URL-s (Need furher settings to do)
$site_config->parameter_autodefine core false Enable using POST and GET parameter without explicit define them. Not recommended because security reasons.
$site_config->enable_hook_table_info debug false Enable hook info pages located /hooks and /hookcalls
$site_config->show_sql_commands_executed debug false Show every sql command on bottom of the page
$db->servertype sql 'none' Type of sql server mysql pgsql none
$db->host sql '' Hostname of the sql server
$db->name sql '' Database name on the sql server
$db->user sql '' Username of the sql server
$db->password sql '' Password for the sql server
$db->auto_error_page sql true Should the sql executer functions automatically redirects to error page when something wrong during an sql operation. (Some kind of automatic error handling)
$db->schema_editor_password sql '' You can specify a password for sql schema editor page here. The editor can reached with this password in case no admin user logged in. (Empty means disabled)
$db->schema_editor_allowed_for_admin sql true Should sql schema editor allowed to use for administrator users without special schema editor password
$site_config->enable_speeformbuilder_preview sfbuilder false
$site_config->enable_speeformbuilder sfbuilder false Enable to use speedformbuilder page: Speedformbuilder
$site_config->node_unauth_triggers_login node false
$site_config->public_file_path file 'data'
$site_config->public_file_url file '/data'
$site_config->secure_file_path file 'data/secure'
$site_config->secure_file_url file '/data/secure'
$site_config->disable_system_doc_target doc false Disable the documentation location of the system: doc/*
You can reuse this location this way.
$flex->mainmenu_pos flex BETWEEN_LOGO_HEADER Properties of flex theme. Controls the location of main menu.
$flex->sidebar_blocks_have_border flex false Properties of flex theme. Sets wheter the sidebar boxes have borders.

Every module can extend this settings with their own by using boot hook. For example if the "mymodule" should have an "amount" value with default value 10 the boot hook looks like this way:


function hook_mymodule_boot()
    global $site_config;
    $site_config->amount = 10;

This way the "amount" value can be changed in site/_settings.php file and can be reach in every module with the default or set value.


A codkep module is a php file or files containing some functionality and is written in PHP. The module code executes within the context of the site, it can use all the functions and access all variables and structures of CodKep core.

You can build and customize your own site by writing modules to CodKep, so that a site building should start by write your own module and extend the core.

The third party and own modules (not system) are located under site directory.

The site/_modules.php contains the $site_modules global associative array which contains the name and path of the loadable modules.

An example site/_modules.php


global $site_modules;

$site_modules =
    "mymodule" => "mymodule.php",
    "anotherlib" => "anotherlib.php",

In the example above

You can enable or disable modules by commention out the line of the desired modules in _modules.php. The modules can modify or extend the CodKep functionalities by hooks. It means that writing own modules named "xyz" is starting with the following steps:

  1. Create an empty xyz.php file in site directory.
  2. Add "xyz" => "xyz.php" line to the $site_modules array in _modules.php file.
  3. Write functions to xyz.php with special names to implement some hooks

The CodKep core's functionality can changed by hooks within the modules.

Page generated in 0.0145 seconds.