Getting Started

Table of Contents

Loading PHP Classes
Zend Framework

Recite CMS is written in PHP. It will only work in PHP 5.1.2 and newer. At time of writing, it runs on Unix-based systems (such as Linux, FreeBSD or Mac OS X). Microsoft Windows support is experimental only. Additionally, it currently supports Apache HTTP Server and PostgreSQL or MySQL database server.

For all development you will require a text editor or Integrated Development Environment (IDE). One editor you can use is jEdit (http://jedit.org). This editor works on all major platforms, and also has a PHP-editing mode.

Loading PHP Classes

Recite CMS uses an automatic class-loading system, meaning you don’t have make calls to PHP functions such as require_once() to load PHP scripts. This relies on all classes (including classes you develop for your custom modules) being named appropriately and stored on the filesystem correctly. Classes are automatically loaded when you try to use them.

For example, the Text_Lipsum class (used to generate dummy "Lorem Ipsum" text) needs to be stored in the application include directory with a path of Text/Lipsum.php. In other words, the class filename should end in .php and underscores in the class name correspond to slashes in the path.

Below are two identical ways in Recite CMS to use this class. Firstly, manually including the class:

Example 2.1. Manually including the PHP class

<?php
    require_once('Text/Lipsum.php');
    echo Text_Lipsum::sentence();
?>

Example 2.2. Auto-loading the Text_Lipsum class simply by using it

<?php
    echo Text_Lipsum::sentence();
?>

It is also important to note that each module in Recite CMS has its own class namespace [1] and include directory. As you will see in the "Developing Custom Modules" document, each module will have the file path ./name/include. For example, if you have a module called Timesheets and a class called Report, its full path (relative to the modules directory) would be ./timesheets/include/Report.php. You must also name the class accordingly, prefixing it with Module_Timesheets_.

For example, to define the class (called Module_Timesheets_Report), you might use the following code.

Example 2.3. Creating the Module_Timesheets_Report class (./timesheets/include/Report.php)

<?php
    class Module_Timesheets_Report
    {
        public function __construct()
        {
        }
    }
?>

Once you have created the class, it would be somewhat cumbersome to include the full path to the class in order to use it. Thanks to the class auto-loader, you don't need to. You can simply use the following code.

Example 2.4. Auto-loading a module class simply by using it

<?php
    $report = new Module_Timesheets_Report();
?>



[1] Not technically a namespace, but for the purposes of this document we'll assume that it is.