Getting started


To install the TiP framework, simply unpack the tarball inside your server. A common convention is to rename the tip directory to tip:

cd /path/to/server
tar xjf /path/to/tarball/tip-0.2.1.tar.bz2
mv tip-0.2.1 tip

Using TiP

Once installed, you are yet able to use the TiP framework. To do this, you must create a proper index.php file.

An empty page

The simpliest site is a blank page. To let the TiP generates this page, use the following index.php:

// Define the TiP environment
require_once './tip/TIP.php';

// Modules configuration
$cfg = array(
    'main'            => array(
        'type'        => array('module', 'application'),
        'engine'      => array(
            'type'    => array('template_engine', 'rcbtng')
        'data_engine' => array(
            'type'    => array('data_engine', 'bucket')

// "main" module instantiation

// Application execution

See the blank page demo.

Every TiP application must have at least one TIP_Application module, in the above case the module called main.

The result is a blank page with a preamble and the <html> root item:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="" xml:lang="it-IT" lang="it-IT">


The hard part to understand is the configuration of the modules.

Module configuration

Every module, that is every class derived from TIP_Module, can be configured by using $cfg, a global array. Every key of cfg identifies a single module and the value of that key should be an array of property=>value elements.
A property of a module is a protected variable of the module. For instance, the type property is the $type variable defined in TIP_Type. The id property is a special property binded to the key of the $cfg global array.

Hello world

Now we'll try to do something more useful than a blank page: the famous Hello world program. Keeping the index.php from the previous section, you should create the style and style/main directories.

$ ls
index.php  tip/
$ mkdir -p style/main
$ ls
index.php  style/  tip/

Inside the style/main directory, create the following head.rcbt file using your preferred text editor.


<title>Hello world (or {getProperty(title)})</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta name="description" content="{getProperty(description)}" />
<meta name="author" content="eNTiDi" />
<meta name="keywords" content="{getProperty(keywords)}" />
<meta name="robots" content="{getProperty(robots)}" />
<meta name="generator" content="tip" />


Do the same with the body.rcbt file.


<p>Hello, world!</p>
<p>The referer is "{REFERER}" and today is {date()}.</p>


See the hello world demo.

Now try to access the page: in few steps you have a working (and XHTML 1.0 compliant) dynamic site.

Getting started was last modified by Nicola on Tue 15 Oct 2013 01:32:35 PM CEST
Hosted by BerliOS Developer Logo