About Research License Donate Contact
Latest stable build is 1.4.0
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. Be sure to visit my blog for additional tips & tricks!

  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 for which you will find the download link to your right, you should follow the numbered steps below to get you started with CompactCMS.

  1. Extract all files by using any compression software. Be sure to keep the folder structure intact while extracting.
  2. Open the file “config.inc.php” in the ./lib/ directory and edit the commented variables. These include MySQL and general site info settings.
  3. If you're installing CCMS under a subdirectory, also be sure to modify the .htaccess file accordingly.
  4. Create a new database (use the name you specified in the “config.inc.php” configuration) and import the structure from the file “structure.sql” which you will find in the ”/_docs” folder.
  5. Now upload all files to your web server and open up the installation path + /admin. If all is set okay, you should see a similar view as can be seen in the CCMS demo.
  6. The folder ”/content” in the root of the installation needs to be set to CHMOD 666 for CompactCMS to work. The ”/admin/includes/cache” folder, is recommended to be set to CHMOD 666 too.

That should already finish up configuring your CompactCMS installation. Now design your own website and put the template file (name.tpl.html) in the ./lib/templates/ directory. Use the CompactCMS template variables to fill your template with the generated content. Also refer to the templates included by default with CompactCMS. See the source code of those templates for practical examples.

3 Full 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. These include general site info and MySQL database settings. 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 and enable the security setting if you don't have any form of password protection already available at your website. Do this by setting the $cfg[security] variable in /lib/config.inc.php to true. Don't forget to change the default username and password as set by the $cfg[user] and $cfg[pass] variables. Also refer to paragraph 4.3 (security variables)

Step 6: set permissions
The folder “content” in the root of the installation needs to be set to at least CHMOD 666 (755 might work on some servers) for CompactCMS to work. The “cache” folder, which you will find in the ”/lib/includes/” directory, should be set to at least CHMOD 666 too, if you want to enable caching.

That should finish up configuring your CompactCMS installation. Now design your own website and put the template file (name.tpl.html) in the ./lib/templates/ directory. Use the CompactCMS template variables to fill your template with the generated content. Also refer to the templates included by default with CompactCMS. See the source code of those templates for practical examples.

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['default']
Your default homepage. This page will show when no file is specified in the address bar. Visiting http://www.compactcms.nl shows the “home” page. In this case $default is set to “home”. This page cannot be deleted from the admin, to prevent your website from showing an error 404 (file not found) on opening.

Examples:

	$cfg['default'] = "home";
	$cfg['default'] = "start";

Variable: $cfg['img_path']
The directory where the images for your template (front-end website) reside in. You'll be able to access this folder using the editor's image manager. Set this variable relative to the root.

Examples:

	$cfg['img_path'] = "img/"; //-> For: http://www.yoursite.com/img/ 
	$cfg['img_path'] = "cms/img/"; //-> For: http://www.yoursite.com/cms/img/

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.

Variable: $cfg['user']

Examples:

	$cfg['user'] = "admin"; //-> Sets the default username to admin

Variable: $cfg['pass']

Examples:

	$cfg['pass'] = "mypass"; //-> Sets the default password for the specified user in $cfg[user] to mypass

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 2.11.6
-- http://www.phpmyadmin.net

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

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

--
-- Table structure for table `pages`
--

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

--
-- Dumping data for table `pages`
--

INSERT INTO `pages` (`page_id`, `urlpage`, `module`, `toplevel`, `sublevel`, `menu_id`, `variant`, `pagetitle`, `subheader`, `description`, `keywords`, `srcfile`, `printable`, `islink`, `iscoding`, `published`) VALUES
(00001, '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, 'installation', 'editor', 2, 0, 1, 'nightlights', 'Installation', 'Get help installing CompactCMS', 'Get help installing CompactCMS', 'compactcms, light-weight cms', 'installation.php', 'Y', 'Y', 'N', 'Y'),
(00003, 'contact', 'editor', 3, 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'),
(00004, 'lightbox', 'lightbox', 4, 0, 1, 'reckoning', 'Lightbox', 'Lightbox module for CCMS', 'This is an example of the lightbox module for CompactCMS', '', 'lightbox.php', 'Y', 'Y', 'N', 'Y');

6 Upgrading instructions

These instructions will follow soon.

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
- {%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