Library License

The CMTK Library is available for download under the Open Source BSD License. If you have any questions regarding the permissions granted under the BSD license, you can find more information at: http://en.wikipedia.org/wiki/BSD_license

The Library is available under the BSD license. All other Tools and Products offered are offered as commercial products and are not released under the BSD license

You can view the current license here: LICENSE.TXT

Latest Download

Download the latest copy of the CMTK Library

cmtk.zip

Library Requirements

  • PHP 5
  • MySQL 4 or 5
  • Tested on Apache and IIS 6
  • Small Download (Current library is only about 1.5 meg)
  • FTP Access (For auto publish tool)

Automated Install

Sign up to use our tools and automate your install process.

Manual Install

To install the CMTK Library on a new web site, do the following steps.

  1. Download the current copy of the library
  2. Create a MySQL database and user/pass (or have your existing information ready)
  3. Unzip the files to the root of your web site
  4. Run the cmtk_db_structure.sql file in your favorite database tool, this should create the cmtk tables needed by the system
  5. Create a folder called cmtk_config in the root of your web site
  6. Create a file called db_config.php in the cmtk_config folder
  7. Add the information in this file to your php file: db_config_example.php
  8. In your PHP files, include the cmtk_include.php file at the top of your script

Getting Started

At this point you should have the CMTK library installed. To start using the library, create a new PHP page in your root web folder called index.php

In the index.php file, include the cmtk_include.php file at the top of the page. This will load the library and start the session. From here on, anything you output from your script will end up in the theme.

Creating your own Theme

Creating your own Theme in the CMTK is easy. By default, the library looks for a template file at (/cmtk_config/templates/default_template.php). If it doesn't find one, it will display your page with no theme. To add a theme file, create the cmtk_config and cmtk_config/templates folders and put a file called default_template.php in that folder. Click the file name for an example.

In the example, we only use a couple of possible tags (CMTK Tags in Bold) and VERY simple HTML. The theme system replaces the CMTK tags with the appropriate content. Making Themes is VERY easy because they are basic HTML pages with a few tags to indicate where to place page content, keywords, page title, and menus. We can generally take an existing design and get it applied and working in just a few minutes. For a complete list of tags, review the Page API documentation.

Once the default template is in place, the library will automatically wrap your pages with this template. You can override this behavior for individual pages (also see the Page API for more documentation).

Config Files

The behavior of your site can be defined by setting the appropriate configuration values. A few properties can only be set in a config file, the rest can be set in a config file or in the database.

For the system to access the database, it needs to know what the database settings are. The library automatically includes all PHP files in the cmtk_config folder (but not in sub folders) so we can place any configuration statements there.

You should have created a file called db_config.php when setting up the library that contained the basic information needed for the library to talk to the database. Properties can now be defined in the database for the site and for pages.

We also declared the Site ID in the php file. The library is setup to use the Site ID when it loads or saves values. This allows you to run multiple sites from the same database.

Site Configuration Options

For a full list of site configuration options, refer to the documentation.

All config values are string values. Keep in mind that when setting a value to true, you are actually setting to a string value of "true", not a boolean value. Here are a few useful options:

  • Error Logging Console - (display_errors = "true") The library can display warnings and errors or it can hide them. This option makes them visible.
  • Set Default Template - (default_template = "template file name") The name of the template file to use by default.
  • Open Sign up - (open_signup = "true") By default an anonymous user can not create a new user account. By setting this to "true", you can call Create User method without having to be logged in. This is useful for sites that allow users to sign up from the web site.

Setting these options will allow you to more easily debug your site and add initial users. You can add these options to the db_config.php file or directly to the database.

Adding Settings to the Config File

Here is an example of setting the options via the config file. Add these lines below the settings in the db_config.php file.


// Show the error log
cmtk_SetConfigValue("display_errors", "true");
// Set the default template
cmtk_SetConfigValue("default_template", "default_template.php");
// Let the system create users without requiring an admin login
cmtk_SetConfigValue("open_signup", "true");

Adding Settings to the Database

You can add the settings to the cmtk_config table in your database. If adding these settings manually, make sure to enter the correct Site ID into the table. NOTE: You don't need to put in an ID, the database will add that automatically.

id site_id key value
CMTK Website display_errors true
CMTK Website default_template default_template.php
CMTK Website open_signup true

Page Settings

To set values for a page, you would enter the information directly into the cmtk_pages table or by using the SetValue method of the page object.

All config values are string values. Keep in mind that when setting a value to true, you are actually setting to a string value of "true", not a boolean value. Here are a few useful options:

  • Page Title - (page_title = "My Page") This value lets you enter a unique page title for each page.
  • Template File - (template_file = "template file name") The name of the template file to use for this page. Not setting this value will let the page use the default site template.
  • view_roles[] - (view_roles[] = "Administrators") To require users to be logged in to view a page, you can add entries under view_roles[]. Yes, that is a [] at the end. By adding [] to the end of the key, the system will treat it as an array. This means that you can have multiple roles that are allowed to view this page.

In this example we setup a page that allows two different roles to view the page (Administrators and Managers).

id site_id page_url key value
CMTK Website /index.php page_title My Page
CMTK Website /index.php template_file default_template.php
CMTK Website /index.php view_roles[] Administrators
CMTK Website /index.php view_roles[] Managers

Moving Forward

At this point, it is time for you to get going. Use the documentation to reference which settings you want to apply for site configuration, users, and pages. It is time to start writing your code!

Message Log: