|« Deploying a Jelix application||References »|
− Table of content
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
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.