Main page Log in

Rabbit/Settings

From Dionyziz

Site-wide settings are specified in the file settings.php, located in your root directory. A pre-made settings file should be shipped with your Rabbit compilation. This should be the first thing that you edit when you start making a new application using Rabbit.

Your settings file should not output anything and should return a PHP dictionary, with each setting name pointing to its value:

<?php
    return array(
        'setting1' => 'value1',
        'setting2' => 'value2',
        ...
    );
?>

Contents

[edit] Rabbit Settings

Here is a list of available setting names and their behavior. All rabbit setting names are strings in lower-case letters and contain only Latin alphabet character and no spaces, numbers, or other symbols (such as the underscore)

[edit] applicationname

Required. String. This setting specifies your project name. Please only specify the name of your application, not a its version. For example, "Chit-Chat", "Dionyziz", "BlogCube" and "Yahoo! Mail" are appropriate names.

[edit] rootdir

Required. String. This setting specified the full path to your local project root directory, i.e. the path where the file "index.php" from Rabbit exists. It should not end with a slash! For example, "/var/www/localhost/htdocs" is appropriate.

[edit] production

Required. Boolean. This setting specifies whether your site is under production. Set it to true if the site is publicly accessible, or to false if it's accessible only by you or your development team. It is very important not to set this setting to false for public websites, as doing so can lead to important security risks! If unsure, please set this to true.

[edit] hostname

Required, if on a web environment. String. Specifies the hostname of the computer your script is running on, which your web server is accessible through.

[edit] port

Required, if on a web environment. Integer. Specified the port of the computer your script is running on, which your web server is accessible through. Usually "80".

[edit] url

Required, if on a web environment. String. This should be the url part of your application directory, not including the final slash. So if, for example, your application runs on http://example.org/foo/, then your url setting should be set to "foo". If it is running on the root of a server, set it to the empty string.

[edit] webaddress

Required, if on a web environment. String. The full URL from which your application is accessible, not including the protocol. For instance, "example.org/foo". Make sure this doesn't end in a slash!

[edit] resourcesdir

String. This setting specifies the full path to a local directory where your resources, i.e. media files uploaded by users, if any, are located. If your project does not use resources, or if your resources are stored on an external server, leave this setting empty.

[edit] imagesurl

String. This is a full URL to your images server, which could be a different server from your rabbit application server. Include the protocol at the beginning and a slash at the end. For example "http://example.org/images/" would be appropriate.

[edit] timezone

Required. String. Your server timezone identifier, or "GMT" if your server is set to use GMT. This is usually a 3-letter identifier, such as "UTC", "PST" or "GMT".

[edit] language

Required. String. Your served physical language identifier. This is "en" for English. Other common languages include "de", "fr", "el" and so forth. If your application is localized, use your main language here. This should be a valid XML physical language.

[edit] databases

Required. This contains a list with your databases. If your application doesn't use any databases, it should be an empty array. Else, it should be an array containing one item for each of your databases. See Rabbit/Db for detailed information about this setting.

[edit] Custom settings

The setting names are prespecified; any settings with other names will simply be ignored by Rabbit. However, you can use this behavior if you wish, to specify your application-specific settings.

<?php
    return array(
        'setting1' => 'value1',
        'setting2' => 'value2',
        ...
        '_appsetting1' => 'valuexx'
        '_appsetting2' => 'valueyy'
    );
?>

If you do, please prefix your setting names that are application-specific with the underscore character (_) to make sure they do not conflict with future rabbit setting names. However, it is advised that you do not use double underscores.

To read custom or rabbit settings, you can access the return value of settings.php by accessing the global variable $rabbit_settings:

<?php
function ElementExample() {
    global $rabbit_settings;
    
    ?>Welcome to <?php
    echo $rabbit_settings[ 'applicationname' ];
    ?>, visitor!<?php
}
?>

[edit] TODO

Write about:

  • Database-related settings
©2012 dionyziz
Attribution-Share Alike 3.0