Quick links: Content - sections - sub sections
EN FR

URL entry points

An entry point is a script which manage some or all your application actions. Only entry points should be web accessible and therefore should lie in www directory of your application.

An entry point create a jCoordinator object, a jRequest object (to parse all request parameters) and indicates which configuration file to use.

Below is an example of an entry point script :


// application initialisation file
require_once ('../../testapp/application.init.php');

// configuration file
$config_file = 'index/config.ini.php';

// jCoordinator object
$jelix = new jCoordinator($config_file);

// jRequest object
require_once (JELIX_LIB_CORE_PATH.'request/jClassicRequest.class.php');
$request = new jClassicRequest();

// action processing
$jelix->process($request);

Theorically, an application should have one entry point per response type : classic, XML-RPC, JSON-RPC, RSS, Atom, and so on.. As a result, each entry point should also have its specific configuration file.

Organization of the configuration

Jelix framework configuration is stored in an ini-like file. It is a file structured by sections ([section name]). Each section is a collection of parameter-name=value pairs. There is a generic section, un-named, usually at the start of such file.

Configuration files are stored in var/config.

As said before, each entry point may have its specific config file. Although in practice, many parameters can be shared between them. To prevent wasteful repeats defines a common config file : defaultconfig.ini.php. Jelix automatically read its entries in addition to each config file related to an entry point. No need to tell jelix about it in an entry point.

Then, should lay in an entry point related config file, only specific parameters or overloaded parameters already defined in defaultconfig.ini.php.

a glimpse at defaultconfig.ini.php (abstract) :


locale = "fr_FR"
charset = "ISO-8859-1"
timeZone = "Europe/Paris"
theme = default

checkTrustedModules = off

; list of modules : module,module,module
trustedModules =

pluginsPath = lib:jelix-plugins/,app:plugins/
modulesPath = lib:jelix-modules/,app:modules/

dbProfils = dbprofils.ini.php

[coordplugins]
;nom = nom_fichier_ini

[responses]
...

Example : a classic request with index.php as entry point should define var/config/index/config.ini.php file. Storing under an index sub-directory serves only a better organization (As each entry point may have its config file, var/config would quickly become a mess).

A specific config should only define or redefine a small amount of properties:


startModule = "testapp"
startAction = "main:index"

[coordplugins]
autolocale = index/autolocale.ini.php

[responses]
html=myHtmlResponse

take xmlrpc.php entry point, its config file could be :



  startModule = "testapp"
  startAction = "xmlrpc:index"

And so on for others entry points.

Content of configuration file

See lib/jelix/core/defaultconfig.ini.php for the whole list of parameters. This file is the "source" of the identically-named file you find in var/config of your application.

Below is a tour of all configuration sections.

generic section

Usually its parameters are at the beginning of file. They define default or global values of the framework.


startModule = "jelix"
startAction = "default:index"
locale = "en_US"
charset = "UTF-8"
timeZone = "US/Pacific"

checkTrustedModules = off

; list of modules : module,module,module
trustedModules =

pluginsPath = lib:jelix-plugins/,app:plugins/
modulesPath = lib:jelix-modules/,app:modules/

dbProfils = dbprofils.ini.php

theme = default
use_error_handler = on

Parameters in details :

  • startModule, startAction : default module and action (generally re-defined for each response type. see preceding section)
  • locale, charset : default language and encoding of responses
  • timeZone : set the time zone for every date and time functions
  • checkTrustedModules, trustedModules et modulesPath : options refering to modules.
  • pluginsPath : path list to plugins. learn more in plugins documentation.
  • dbProfils : Database profiles configuration file. See database access.
  • theme : default selected theme. Read theme system description.
  • use_error_handler : this option shoud stay on for Jelix to return useful and detailed errors or exceptions.

coordplugins section

List all coordinator plugins Jelix has to activate. They will be loaded from the list of path defined by the pluginsPath option.

The example below demonstrates the activation of an authentication plugin. Its own set of options are defined in auth.coord.ini.php file. Learn more about authentication.


[coordplugins]
;plugin name = ini filename
auth = "auth.coord.ini.php"

responses section

this section allows to customize each response type and its alias. each line consists of a couple <response alias>=<response class>.

As for example, it is usual to overload html default response (jResponseHtml) by such a line : html=myhtmlresponse. Find more details in customizing common response

Below are the default alias and response types:


[responses]
html = jResponseHtml
redirect = jResponseRedirect
redirectUrl = jResponseRedirectUrl
binary = jResponseBinary
text = jResponseText
jsonrpc = jResponseJsonrpc
json = jResponseJson
xmlrpc = jResponseXmlrpc
xul = jResponseXul
xuloverlay = jResponseXulOverlay
xuldialog = jResponseXulDialog
xulpage = jResponseXulPage
rdf = jResponseRdf
xml = jResponseXml
zip = jResponseZip
rss2.0 = jResponseRss20
atom1.0 = jResponseAtom10
css= jResponseCss
ltx2pdf= jResponseLatexToPdf
tcpdf = jResponseTcpdf

error_handling section

Those parameters are used to configure notifications occuring during an application script execution. Details can be found in error manager documentation.

Notifications have different levels. Jelix defined levels corresponding to PHP error_reporting levels:

  • default = selected level if no other level corresponds
  • error = notify an error stopping a script execution
  • warning = notifu an error which doesn't stop a script
  • notice = notify a possible error
  • deprecated = notify a deprecated function (php 5.3)
  • strict = notify core PHP messages about compatibility and interoperability

Below are the whole list of parameters:


[error_handling]
messageLogFormat = "%date%\t%ip\t[%code%]\t%msg%\t%file%\t%line%\n"
logFile = error.log
email = root@localhost
emailHeaders = "Content-Type: text/plain; charset=UTF-8\nFrom: webmaster@yoursite.com\nX-Mailer: Jelix\nX-Priority: 1 (Highest)\n"
quietMessage="A technical error has occured. Sorry for this trouble."

showInFirebug = off

; keywords you can use : ECHO, ECHOQUIET, EXIT, LOGFILE, SYSLOG, MAIL, TRACE
default      = ECHO EXIT
error        = ECHO EXIT
warning      = ECHO
notice       = ECHO
deprecated   = ECHO
strict       = ECHO
; exceptions implicitly use EXIT
exception    = ECHO
  • messageLogFormat and logFile configure a log file output (LOGFILE or SYSLOG)
  • email et emailHeaders configure mail ouptut (MAIL)
  • quietMessage defines a neutral message for user (ECHOQUIET)
  • showInFirebug : if on, all notifications will be redirected to firebug extension of firefox browser using its console api.

The last set of options allows to associate ouptut formats to each level of notification. Each level can have more than one output format. For example, in production, you'll probably want to set :error = ECHOQUIET EXIT LOGFILE and so on.

compilation section

Defines the template behavior of Jelix template engine. And more precisely of its compilation step. Find in-depth details in templates.


[compilation]
checkCacheFiletime  = on
force  = off
  • checkCacheFiletime : if on template will be compiled if its file modification date is more recent than its already PHP compiled file.
  • force : if on, template is systematically compiled

section zone

There is an option to globally disable zone caching. It is useful during development environment but should be set to off in production.

To disable zone caching :


[zones]
disableCache = on  // default to off

urlengine section

@TODO : à compléter

logfiles section

This section defines how log calls through jLog api will be output. Log files are created and stored in /var/log/ application folder.

A per-module log file can be defined by setting a couple <module name>=<log filename> and calling jLog methods with <module name> as last argument.


; default log
  default = messages.log

; log for "news" module
  news = news.log

Another example shows how you can use firebug extension as a log output (useful for quickly debugging). Still you can log to a classic file calling jLog methods with file as last argument (for dumping huge content for example).


[logfiles]
default="!firebug"
file = "messages.log"

Learn more about Jelix debugging through jLog documentation.

mailer section

Parameters required to send mails through application scripts. As for example, authentication or notifications can send emails.


[mailer]
webmasterEmail = root@localhost
webmasterName =

; How to send mail : "mail" (mail()), "sendmail" (call sendmail), or "smtp" (send directly to a smtp)
mailerType = mail
; Sets the hostname to use in Message-Id and Received headers
; and as default HELO string. If empty, the value returned
; by SERVER_NAME is used or 'localhost.localdomain'.
hostname =
sendmailPath = "/usr/sbin/sendmail"

; if mailer = smtp , fill the following parameters

; SMTP hosts.  All hosts must be separated by a semicolon : "smtp1.example.com:25;smtp2.example.com"
smtpHost = "localhost"
; default SMTP server port
smtpPort = 25
; SMTP HELO of the message (Default is hostname)
smtpHelo =
; SMTP authentication
smtpAuth = off
smtpUsername =
smtpPassword =
; SMTP server timeout in seconds
smtpTimeout = 10

acl section

Defines options of access control list (ACL) or rights management. See rights management. You can use jAcl ou jAcl2, but not both at the same time. Indicate a driver to enable it.


[acl]
; example of driver : "db"
driver =

[acl2]
; example of driver : "db"
driver =

sessions section

Determines how PHP sessions are stored (file or databse). Find more details in sessions documentation.


[sessions]
shared_session = off
; Use alternative storage engines for sessions
;
; usage :
;
; storage = "files"
; files_path = "app:var/sessions/"
;
; or
;
; storage = "dao"
; dao_selector = "jelix~jsession"
; dao_db_profile = ""