Quick links: Content - sections - sub sections
Developer manual
  • Tips
  • No other pages in this book
Jelix 1.8.1

Part: Tips

« Deploying a Jelix application References »
Switch to language: FR

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.


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 jAuth::getUserSession():


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:

<property inserpattern="NOW()" .../>

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

<property updatepattern="NOW()" .../>

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