Configuration
Drake configuration is an INI file under its installation directory (modules/drake inside Drupal’s main directory), named drake.ini. With that configuration file you’ll be able to set up different CakePHP applications that will be available for running in Drupal via Drake, and also specify which of those will be executed by default.
Some Drake users may be wondering why we chose to use a configuration file instead of Drupal’s built in settings API. There are several reasons (such as to make Drake configurable the same way its sister project, Jake, is), but main of all: to keep things simple. Since the most important part of Drake configuration file is the path to your CakePHP application it is easier to maintain paths on a configuration file than on the database.
Drake’s configuration file behaves the same way any standard INI file: by defining sections and key-value pairs. Each section should be defined between brackets. There’s one special section (named settings) that is used to specify Drake’s general settings, while the rest of the sections will be considered as the definition of different CakePHP applications that will be available through Drake.
Let’s see an example configuration file:
default = "my_app"
[my_app]
name = "My CakePHP application"
path = "../cake1.2/app/webroot"
url = "/cake1.2"
send = "parameter=value"
Each application should define the following parameters (note that all strings must be enclosed between quotes, and that certain parameters are not mandatory):
- name: a descriptive name used in Drake’s administration page. This parameter is optional.
- path: the path to your CakePHP application’s webroot directory (this is usually
app/webrootinside CakePHP’s directory). You can either specify an absolute path (such as/home/httpdocs/cake/app/webroot) or a relative path, which will be relative to Drupal’s main directory (for example../cake/app/webroot). This parameter is mandatory. - url: the absolute URL to your CakePHP application. If your cake application is accessible via
http://www.server.com/cakethen this would be/cake, since the protocol and server name is not needed when both Drupal and your CakePHP applications are running on the same host. This parameter is mandatory. - send: if you want to send additional parameters to your CakePHP application (that will be accessible through PHP’s
$_REQUESTindexed array) then set them here in the form of a valid query string. For example if you specifyparam1=dummy1then your CakePHP application can use$_REQUEST['param1']to obtain the value of the parameter. Separate each parameter-value pair with the ampersand sign. This parameter isoptional.
Remember that for each application you need to set up its identifier (only consisting of letters, numbers, and the underscore sign) as the INI section name, without using the reserved word settings, and then simply set your application specific parameters.
The settings section that is used to specify Drake general settings, consists of the following parameters:
- default: the identifier of the default CakePHP application to run. This parameter is mandatory.
Documentation
Navigate
Categories
Can't Miss
- SYPAD Developers CommunityQuality articles, tutorials and projects for developers.
- SYPAD Outsourcing MarketplaceGet your project done, or bid on projects.