About Research License Donate Contact
Latest stable build is 1.4.1
See upcoming changes
» Home » Documentation Print

Getting started and advanced tips

On this page you'll find documentation on the installation and configuration of CompactCMS.

  1. Requirements
  2. Quick installation
  3. Full installation instructions
  4. Configuration variables
  5. MySQL database structure
  6. Upgrading
  7. Template variables

1 Requirements

Before you consider to install CompactCMS on your server to manage your next or current website, it is important that you understand that CompactCMS has a few, although standard, system requirements you need to meet for the CMS to work. If you're not sure whether you meet the requirements stated below, please refer to your hosting company.

2 Quick installation

After downloading the package, you should follow the numbered steps below to get you started with the CompactCMS installation.

  1. Extract all files by using any compression software. Be sure to keep the folder structure intact while extracting.
  2. Upload all of the extracted files to a remote location of your choosing.
  3. Create a new database, or note down details from a current one to be used for your CCMS install
  4. Point your web browser to the directory where you uploaded the files to. This will show you the installer.
  5. After installing, be sure to remove the /_install/ directory before trying to access the backend under /admin/.

That is all there is to it. The installer should guide you through the necessary steps. If anything goes wrong, refer to the next chapter for manual installation instructions. To start designing your own template, take a look at the included examples. Chapter seven lists all of the template variables that you can use.

3 Manual installation instructions

Step 1: extract files
Extract all files by using Winzip, Winrar or any other compression software kit. Be sure to keep the folder structure intact while extracting.

Step 2: edit configuration file
Open the file /lib/config.inc.php and edit the commented variables. Do NOT change the $cfg['authcode'] variable (default is 12345), as this value is required to log you in using the default credentials. An elaboration on the variables used, can be found in chapter 4.

Tip: if you later on run intro trouble, please make sure these settings are correct. Database name, username and password are case-sensitive.

Step 3: edit .htaccess file
If you're installing CompactCMS in the root of your public folder the .htaccess file will not need changing. You can then skip this step.

If you have installed CompactCMS in another directory than the root, you should open up the ”.htaccess” file included within the archive. By default the root configuration is enabled. If you want to use the sub directory configuration you should set the RewriteBase variable appropriately.

# For an installation under root (default)
# Example: www.mysite.com/index.php
RewriteBase /

# For an installation under /cms
# Example: www.mysite.com/cms/index.php
# RewriteBase /cms/

# For an installation under /test/compactcms
# Example: www.mysite.com/test/compactcms/index.php
# RewriteBase /test/compactcms/

Also see the file itself for further details. In case you already have such a file, you should merge the two together into one file.

Step 4: create database structure
Create a new database (use the name you specified in the configuration) and import the structure as shown below or use the structure.sql file in the included /_docs/ directory.

The instructions below indicate on how to import the structure.sql file.

  1. First select the import tab
  2. Then click “Browse..” and select the structure.sql file in the /_docs/ directory
  3. Hit the “Go” button

Step 5: upload to server
Upload all files to your webserver. You'll now be able to access the backend under www.yoursite.com/admin/. Your default user credentials are username: admin, password: pass. Don't forget to change these default values through the backend. If you cannot log in, make sure that $cfg['authcode'] is set to 12345 in the /lib/config.inc.php file.

Step 6: set permissions
The following files require specific chmod() actions. Use your FTP software to change these values to the ones listed below

A note on file permissions:
It is true that 0777 forms a security risk for your installation under a Linux installation. All web scripts have this risk if running without a FTP layer (having sufficient risks on its own). If your hosting provider is doing a good job though, chmod values should not pose a risk. You could consider creating all of the mentioned directories through the Apache server itself (making Apache the file owner) and only manage the contents through the CCMS backend. This will lower the requirements from 0777 to 0666. Unfortunately you will then not be able to upload modifications through FTP, as the file owner is not your FTP account, but the Apace server.

4 Configuration variables

Below you'll find a list of all the variables currently used by CompactCMS. The standard variables (4.1) and MySQL variables (4.4) need changing for CompactCMS to work. The other variables should work out of the box and should be changed when in need of changed behavior of CompactCMS.

4.1 Standard variables

Variable: $cfg['sitename']
This should include the name of your website. It can be used for showing a copyright line in the footer of each page and by default will show in the header tag of each webpage.

Examples:

	$cfg['sitename'] = "CompactCMS"
	$cfg['sitename'] = "Soccer Fansite";

Variable: $cfg['language']
This will affect the language of the administration. Please therefore make sure that the language your selecting is available in the ”/admin/includes/languages/” directory. This variable is furthermore used for indicating to browsers and search engines which language your website is in.

Examples:

	$cfg['language'] = "en"; //-> english
	$cfg['language'] = "nl"; //-> dutch 
	$cfg['language'] = "de"; //-> german

Variable: $cfg['rootdir']
The CCMS script needs to know where to look for its files relative to the document root. Set this variable to reflect where your installation resides. Always add a trailing slash.

Examples:

	$cfg['rootdir'] = "/"; //-> For an install under root (www.yoursite.com/)
	$cfg['rootdir'] = "ccms/"; //-> If under a sub directory (www.yoursite.com/ccms/)
	$cfg['rootdir'] = "tests/cms/"; //-> For www.yoursite.com/tests/cms/

Variable: $cfg['authcode']
This unique code is used to encrypt (salt) your CCMS passwords and allows you to preview pages that are unpublished. Be careful to change your authcode after install, it will make your current user credentials unusable. Choose carefully!

Examples:

	$cfg['authcode'] = "12345";
	$cfg['authcode'] = "A1b2C";

4.2 Extended configuration

Variable: $cfg['version'] [true|false]
Description

Examples:

	$cfg['version'] = "true"; //-> Check for new version on initial load (default)
	$cfg['version'] = "false"; //-> Disable checking for a new version

Variable: $cfg['iframe'] [true|false]
By default the management of iframes is not supported. Giving your end-users the possibility to include external pages within the local website brings along risks. Most importantly it could open doors to include malicious scripts which can cause the webserver to go down. As long iframes are not needed, keep the value set to false. If iframes are needed set this value to true, but make sure you limit access to the administration. Enabling support for iframes is on your own risk.

Examples:

	$cfg['iframe'] = "false"; //-> Do not support iframe management (default)
	$cfg['iframe'] = "true"; //-> Enable support for iframe management

Variable: $cfg['wysiwyg'] [true|false]
To prevent coding from being broken due to the use the WYSIWYG editor, this editor can be disabled all together. By setting this variable to false, all editable content will be loaded in a regular textarea. Preventing the loss of coding.

Examples:

	$cfg['wysiwyg'] = true; //-> Enable the WYSIWYG editor [true/false]

4.3 Security variables

Variable: $cfg['protect']

Examples:

	$cfg['protect'] = true; //-> This will require you to login.

4.4 MySQL database variables

Variable: $cfg['mysql_host']
Enter the host of your MySQL server here. This should be “localhost” in 96% of the cases.

Examples:

	$cfg['mysql_host'] = "localhost"; 
	$cfg['mysql_host'] = "127.0.0.1";

Variable: $cfg['mysql_user']
The username for accessing your MySQL database. This is not likely to be “root” unless you're on dedicated or local hosting.

Example:

	$cfg['mysql_user'] = "root";

Variable: $cfg['mysql_pass']
Set this variable to your MySQL password which belong to the username specified above. Make sure you always have a password set to prevent others from accessing your database (unless on local).

Example:

	$cfg['mysql_pass'] = "compactcms";

Variable: $cfg['mysql_db']
The name of the database you are planning to use for CompactCMS. This could be anything. Note that you don't need a seperate database for CompactCMS to work. The *.sql file included with this package only creates one table.

Example:

	$cfg['mysql_db'] = "compactcms";

4.5 Other variables

Variable: $cfg['restrict']
If you have one or multiple files with specific PHP coding, you should restrict editor access to these files. Opening either Javascript or PHP coding within the online editor will cause loss of code. Specify the pages that contain special code using this variable. Access to these files will then be restriced for the administration. These files can only be modified with your favourite editor, directly using a FTP program (download - edit - upload).

! Use the filenames without extension.

Examples:

	$cfg['restrict'] = array("sitemap", "phpform");
	$cfg['restrict'] = array("sitemap");
	$cfg['restrict'] = array("faq", "contact", "newsletter");

Tip: to see if you configured this variable right, open up the admin and check whether the edit and preview links are replaced by “Restriced content” for the specified pages.

5 MySQL database structure

Below you'll find the contents of the "structure.sql" file. If you know how to use this syntax, then go ahead and copy & paste the code. Otherwise use the structure.sql file included with the archive and import it into your database using PhpMyAdmin. See step 4 above on how to import the structure.sql file.

-- phpMyAdmin SQL Dump
-- version 3.2.0.1
-- http://www.phpmyadmin.net
--

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

-- --------------------------------------------------------

--
-- Table structure for table `ccms_cfgcomment`
--

DROP TABLE IF EXISTS `ccms_cfgcomment`;
CREATE TABLE IF NOT EXISTS `ccms_cfgcomment` (
  `cfgID` int(5) unsigned zerofill NOT NULL AUTO_INCREMENT,
  `pageID` varchar(100) CHARACTER SET latin1 NOT NULL,
  `showLocale` varchar(5) CHARACTER SET latin1 NOT NULL DEFAULT 'eng',
  `showMessage` int(5) NOT NULL,
  PRIMARY KEY (`cfgID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `ccms_cfgnews`
--

DROP TABLE IF EXISTS `ccms_cfgnews`;
CREATE TABLE IF NOT EXISTS `ccms_cfgnews` (
  `cfgID` int(5) NOT NULL AUTO_INCREMENT,
  `pageID` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `showLocale` varchar(5) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'eng',
  `showMessage` int(5) NOT NULL DEFAULT '3',
  `showAuthor` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
  `showDate` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
  `showTeaser` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  PRIMARY KEY (`cfgID`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration variables for modNews' AUTO_INCREMENT=2 ;

-- --------------------------------------------------------

--
-- Table structure for table `ccms_cfgpermissions`
--

DROP TABLE IF EXISTS `ccms_cfgpermissions`;
CREATE TABLE IF NOT EXISTS `ccms_cfgpermissions` (
  `manageUsers` int(1) NOT NULL DEFAULT '3' COMMENT 'From what user level on can users manage user accounts (add, modify, delete)',
  `manageOwners` int(1) NOT NULL DEFAULT '3' COMMENT 'To allow to appoint certain users to a specific page',
  `managePages` int(1) NOT NULL DEFAULT '1' COMMENT 'From what user level on can users manage pages (add, delete)',
  `manageMenu` int(1) NOT NULL DEFAULT '2' COMMENT 'From what user level on can users manage menu preferences',
  `manageTemplate` int(1) NOT NULL DEFAULT '3' COMMENT 'From what user level on can users manage all of the available templates',
  `manageModules` int(1) NOT NULL DEFAULT '5' COMMENT 'From what user level on can users manage modules',
  `manageActivity` int(1) NOT NULL DEFAULT '2' COMMENT 'From what user level on can users manage the activeness of pages',
  `manageVarCoding` int(1) NOT NULL DEFAULT '3' COMMENT 'From what user level on can users set whether a page contains coding (wysiwyg vs code editor)',
  `manageModBackup` int(1) NOT NULL DEFAULT '3' COMMENT 'From what user level on can users delete current back-up files',
  `manageModNews` int(1) NOT NULL DEFAULT '2' COMMENT 'From what user level on can users manage news items through the news module (add, modify, delete)',
  `manageModLightbox` int(1) NOT NULL DEFAULT '2' COMMENT 'From what user level on can users manage albums throught the lightbox module (add, modify, delete)',
  `manageModComment` int(1) NOT NULL DEFAULT '2' COMMENT 'The level of a user that is allowed to manage comments'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `ccms_cfgpermissions`
--

INSERT INTO `ccms_cfgpermissions` (`manageUsers`, `manageOwners`, `managePages`, `manageMenu`, `manageTemplate`, `manageModules`, `manageActivity`, `manageVarCoding`, `manageModBackup`, `manageModNews`, `manageModLightbox`, `manageModComment`) VALUES (3, 0, 2, 2, 4, 4, 2, 4, 3, 2, 2, 2);

-- --------------------------------------------------------

--
-- Table structure for table `ccms_modcomment`
--

DROP TABLE IF EXISTS `ccms_modcomment`;
CREATE TABLE IF NOT EXISTS `ccms_modcomment` (
  `commentID` int(5) unsigned zerofill NOT NULL AUTO_INCREMENT,
  `pageID` varchar(100) NOT NULL,
  `commentName` varchar(100) NOT NULL,
  `commentEmail` varchar(100) NOT NULL,
  `commentUrl` varchar(100) DEFAULT NULL,
  `commentContent` text NOT NULL,
  `commentRate` enum('1','2','3','4','5') NOT NULL,
  `commentTimestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `commentHost` varchar(20) NOT NULL,
  PRIMARY KEY (`commentID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table containing comment posts for CompactCMS guestbook mo' AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `ccms_modnews`
--

DROP TABLE IF EXISTS `ccms_modnews`;
CREATE TABLE IF NOT EXISTS `ccms_modnews` (
  `newsID` int(5) unsigned zerofill NOT NULL AUTO_INCREMENT,
  `userID` int(5) unsigned zerofill NOT NULL,
  `pageID` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `newsTitle` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `newsTeaser` text COLLATE utf8_unicode_ci NOT NULL,
  `newsContent` text COLLATE utf8_unicode_ci NOT NULL,
  `newsModified` datetime NOT NULL,
  `newsPublished` enum('0','1') COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`newsID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `ccms_modules`
--

DROP TABLE IF EXISTS `ccms_modules`;
CREATE TABLE IF NOT EXISTS `ccms_modules` (
  `modID` int(5) unsigned zerofill NOT NULL AUTO_INCREMENT,
  `modName` varchar(200) COLLATE utf8_unicode_ci NOT NULL COMMENT 'File name',
  `modTitle` varchar(200) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Friendly name',
  `modLocation` text COLLATE utf8_unicode_ci NOT NULL,
  `modVersion` decimal(5,2) NOT NULL,
  `modPermissionName` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  `modActive` enum('0','1') COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`modID`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Table with the installed modules, their version and activene' AUTO_INCREMENT=4 ;

--
-- Dumping data for table `ccms_modules`
--

INSERT INTO `ccms_modules` (`modID`, `modName`, `modTitle`, `modLocation`, `modVersion`, `modPermissionName`, `modActive`) VALUES
(00001, 'News', 'News', './lib/modules/news/news.Manage.php', 1.00, 'manageModNews', '1'),
(00002, 'Lightbox', 'Lightbox', './lib/modules/lightbox/lightbox.Manage.php', 1.00, 'manageModLightbox', '1'),
(00003, 'Comment', 'Comments', './lib/modules/comment/comment.Manage.php', 1.10, 'manageModComment', '1');

-- --------------------------------------------------------

--
-- Table structure for table `ccms_pages`
--

DROP TABLE IF EXISTS `ccms_pages`;
CREATE TABLE IF NOT EXISTS `ccms_pages` (
  `page_id` int(5) unsigned zerofill NOT NULL AUTO_INCREMENT,
  `user_ids` varchar(300) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0' COMMENT 'Separated by ||',
  `urlpage` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `module` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'editor',
  `toplevel` tinyint(5) DEFAULT NULL,
  `sublevel` tinyint(5) DEFAULT NULL,
  `menu_id` int(5) DEFAULT '1',
  `variant` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ccms',
  `pagetitle` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `subheader` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `description` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `keywords` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `srcfile` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `printable` enum('Y','N') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Y',
  `islink` enum('Y','N') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Y',
  `iscoding` enum('Y','N') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'N',
  `published` enum('Y','N') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Y',
  PRIMARY KEY (`page_id`),
  UNIQUE KEY `urlpage` (`urlpage`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='Table with details for included pages' AUTO_INCREMENT=3 ;

--
-- Dumping data for table `ccms_pages`
--

INSERT INTO `ccms_pages` (`page_id`, `user_ids`, `urlpage`, `module`, `toplevel`, `sublevel`, `menu_id`, `variant`, `pagetitle`, `subheader`, `description`, `keywords`, `srcfile`, `printable`, `islink`, `iscoding`, `published`) VALUES
(00001, '0', 'home', 'editor', 1, 0, 1, 'ccms', 'Home', 'The CompactCMS demo homepage', 'The CompactCMS demo homepage', 'compactcms, light-weight cms', 'home.php', 'Y', 'Y', 'N', 'Y'),
(00002, '0', 'contact', 'editor', 2, 0, 1, 'sweatbee', 'Contact form', 'A basic contact form using Ajax', 'This is an example of a basic contact form based using Ajax', 'compactcms, light-weight cms', 'contact.php', 'Y', 'Y', 'Y', 'Y');

-- --------------------------------------------------------

--
-- Table structure for table `ccms_users`
--

DROP TABLE IF EXISTS `ccms_users`;
CREATE TABLE IF NOT EXISTS `ccms_users` (
  `userID` int(5) unsigned zerofill NOT NULL AUTO_INCREMENT,
  `userName` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `userPass` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `userFirst` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `userLast` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `userEmail` varchar(75) COLLATE utf8_unicode_ci NOT NULL,
  `userActive` tinyint(1) NOT NULL,
  `userLevel` tinyint(1) NOT NULL,
  `userToken` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `userLastlog` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `userTimestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`userID`),
  UNIQUE KEY `userName` (`userName`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Table with users for CompactCMS administration' AUTO_INCREMENT=2 ;

--
-- Dumping data for table `ccms_users`
--

INSERT INTO `ccms_users` (`userID`, `userName`, `userPass`, `userFirst`, `userLast`, `userEmail`, `userActive`, `userLevel`, `userToken`, `userLastlog`, `userTimestamp`) VALUES
(00001, 'admin', '52dcb810931e20f7aa2f49b3510d3805', 'Xander', 'G.', 'xander@compactcms.nl', 1, 4, '5168774687486', '2010-09-01 06:00:00', '2010-09-01 09:00:00');

6 Upgrading instructions

You are encouraged to do a clean install if upgrading to 1.4.1. The file structure has significantly changed.

Make sure you back-up your /content/ and media directories, your templates and database tables. You can - after doing a clean install - restore these manually. In doing so, please make sure that:

I apologize for making upgrading to 1.4.1 relatively hard. If unsure, consider not upgrading at all. Otherwise, be sure to keep a back-up of your current pages, media, templates and database data while trying to manually upgrade to 1.4.1.

7 Template variables

The default templates give you a working example of the various variables that can be used within your template to show content from your CompactCMS back-end. For example when you request the file "contact.html" all of the variables below will be filled with the appropriate content. The variable {%urlpage%} becomes "contact" and the {%pagetitle%} could become something like "Contact us now!" depending what value you have entered in the back-end.

Please refer to the example templates for a demonstration of how these variables are used.

>> General variables
- {%urlpage%}			| The current filename that is being shown
- {%rootdir%}			| The directory your CCMS is installed under, relative to the root (for external files)
- {%title%}				| Use this tag within you <title></title> tag for optimal SEO
- {%pagetitle%}			| Displays the current pagetitle (good for a <h1> tag)
- {%subheader%}			| A short slogan, descriptive text for the current page (<h2>)
- {%sitename%}			| Use this anywhere you want to show your sitename (e.g.: copyright)
- {%desc%}				| An "extensive" description of the current page (use as meta description)
- {%keywords%}			| Keywords (tags) for the current page as specified in the back-end (use as meta keywords)
- {%breadcrumb%} 		| Show the breadcrumb/pathway to the current file
- {%printable%}			| Use as: {%IF printable (eq Y)%}<a href="print/{%urlpage%}.html">Print</a>{%/IF printable%}
	
>> Menu items
- {%mainmenu%}			| Prints an ordered list (<ul>) with all current published files in specified menu
- {%leftmenu%}			| ''
- {%rightmenu%}			| '' 
- {%footermenu%}		| ''
- {%extramenu%}			| ''
	
>> Content tag
- {%content%}			| The content from the current file that is being requested
MySQL database structure