Quick links: Content - sections - sub sections
EN FR
The page corresponding to the latest stable release can be seen in the Jelix 1.8 Manual
Developer manual
  • Tips
  • No other pages in this book
Jelix 1.2.13

Part: Tips

« Deploying a Jelix application References »

Tips for common problems

This page gather snippets of code resolving common development problems.

Prevent some errors

Upon an html request, don't forget that line at the beginning of an action.


$rep = $this->getResponse('html');

Retrieve current action

Use this expression to retrieve current action in a controller, a zone, your common response.


$GLOBALS['gJCoord']->action->toString();

Access user session variables

Jelix use PHP sessions by default. If you use jAuth, it stores user dao record (data coming from jelix_user table) in a PHP session variable. Thus, user infos are accessible through $_SESSION['JELIX_USER'] variable :


$_SESSION['JELIX_USER']->login

Store current date in database

This one applies to date fields having datetime or date as type.

Just add the following attributes to the property line associated with your date field and located in your DAO xml file :


inserpattern="NOW()"

your date field will be set to current date on record insert.


updatepattern="NOW()"

your date field will be set to current date on record update.