ZnetDK 4 Mobile


Frequently Asked Questions about ZnetDK for Mobile.

No answer to your question? Feel free to ask your question on the ZnetDK for Mobile forum.


Is Znetdk for Mobile suitable for developing large applications?

The main difficulty when developing a large application is to structure and organize the source code as efficiently and logically as possible.

ZnetDK meets these requirements through the development of modules, each of them offering business (eg invoice management) or technical (eg sending marketing emails) functionalities.

A module groups together the source code of the view (in HTML, JavaScript and CSS), of the controllers (in PHP) and of models (DAO and MySQL), all in a tree structure of files making it possible to clearly separate the responsibility of each.

By distributing the source code within the different modules, the application can ultimately be very small in terms of software code and be limited to global configuration scripts of the application (INSTALL_DIR/applications/default/app/config.php and INSTALL_DIR/applications/default/app/lang/locale.php) and to the definition of the navigation menu in the INSTALL_DIR/applications/default/app/menu.php script.

Where are PHP errors logged?

The PHP errors are logged in the INSTALL_DIR/engine/log/errors.log file.

The errors.log file traces:

  • Native PHP errors (including not catched exceptions),
  • Errors triggered by ZnetDK framework (including exceptions),
  • Errors traced explicitaly by the developer via the \General::writeErrorLog() method and the exceptions which he threw.

Is it possible to customize HTTP 403 and HTTP 404 error pages?

When the .htaccess Apache file located in the ZnetDK root directory is properly configured, then HTTP 403 and HTTP 404 errors are redirected to a dedicated view in charge of displaying the error.

This view named httperrors.php can be customized by :

  • Copying the core version from the INSTALL_DIR/engine/core/view/ directory to the INSTALL_DIR/applications/default/app/view/ directory.
  • Editing the copy of the httperrors.php script and changing its content according to your needs.

If your application is configured for multi-language display, the view once translated in another language, can be suffixed by the language code as is done for an application view (eg httperrors_es.php in Spanish).

How to change the display language of the Starter App?

The Starter App shipped with ZnetDK is displayed in English. The ZnetDK core features are also translated in Spanish and French.

To develop your Web App with a display that matches your own language, please see the Language settings section.


Where is located the source code of the Starter App?

The source code of the Starter App is located within the INSTALL_DIR/applications/default/ folder (see App folders).

How to install the latest version of ZnetDK without overwriting the source code of my Web App?

To upgrade ZnetDK to the latest version while preserving the source code of your Web Application:

  1. Rename the installation directory of the old version of ZnetDK by adding .OLD extension (eg to /home/john/www/znetdk4m.OLD/).
  2. Install the latest version of ZnetDK (eg in /home/john/www/znetdk4m/) in replacement of the old version.
  3. Remove the default/ folder in the installation directory of the latest version of ZnetDK (eg the /home/john/www/znetdk4m/applications/default/ folder),
  4. Restore the original version of the default/ folder (eg from the /home/john/www/znetdk4m.OLD/applications/default/ folder).
  5. If you developed Modules, also restore the content of the modules/ folder (eg from the /home/john/www/znetdk4m.OLD/engine/modules/ folder),
  6. Check your Web App is working properly in latest version of ZnetDK,
  7. Remove the old version of ZnetDK (eg the /home/john/www/znetdk4m.OLD/ folder).


How to change the color theme of my Web App?

Just edit the INSTALL_DIR/applications/default/app/config.php of your Web App and set the Color Theme Style Sheet URL by changing the CFG_MOBILE_W3CSS_THEME parameter.
The procedure to customize the color theme of your Web App is explained in the section Setting the theme colors.

How to apply a custom font to my Web App?

Edit the INSTALL_DIR/applications/default/app/config.php of your Web App and change the values of the CFG_MOBILE_CSS_FONT and CFG_MOBILE_CSS_FONT_FAMILY parameters.
The procedure to customize the theme font of your Web App is explained in the section Setting the theme font.


How to limit access to the navigation menu?

Access to the navigation menu can be limited via User Profiles.

  1. From your Web App, click on the Authorizations and Profiles menus, add a new profile, give it a name and select the menu items to grant to users.
  2. Then edit the user and assign him the new profile. Make sure to uncheck the Menu Access Full, otherwise, no restrictions to the menu items will be applied by the selected profile.

For more informations, see section User rights.

How to extend the session duration of an authenticated user?

By default, once a user is authenticated, his user session expires after 10 minutes of inactivity.

  • If user checks the Remember me checkbox from the login form, then the user's session never expires (or expires after a period of inactivity corresponding to the one entered for the session.gc_maxlifetime parameter in the hosting php.ini file).
  • Otherwise when the Remember me checkbox is left unchecked by the user, the expiration duration of 10 minutes can be decreased or increased by changing the value of the CFG_SESSION_TIMEOUT parameter.
  • The Remember me checkbox is hidden on the login form when the CFG_SESSION_SELECT_MODE parameter is set to FALSE and the session expiration is disabled when the CFG_SESSION_DEFAULT_MODE parameter is set to 'private'.


How to add extra style sheets to my Web App?

Extra style sheets can be added permanently to your Web App by specifying explicitly their path or URL to the CFG_APPLICATION_CSS PHP constant in the INSTALL_DIR/applications/default/app/config.php script.

When style sheets are directly hosted by the Web App, then they can be copied into a module (for example in INSTALL_DIR/engine/modules/my_module/public/css/minified/). In this way, ZnetDK automatically detects their presence and adds them to the Web App.

How to add extra JS libraries to my Web App?

According to the same principle as the style sheets, extra JavaScript libraries can be added permanently to your Web App by specifying explicitly their path or URL to the CFG_APP_JS PHP constant in the INSTALL_DIR/applications/default/app/config.php script.

When JS libraries are directly hosted by the Web App, then they can be copied into a module (for example in INSTALL_DIR/engine/modules/my_module/public/js/minified/). In this way, ZnetDK automatically detects their presence and adds them to the Web App.

Can application controller be exposed as a web service?

One or several controller actions of a Web App can be exposed as web services and be invoked by a remote application or process.
See the Web Services section for more details.

Is it possible to force the views of my Web App to reload each time they are displayed?

By default, the Web App is configured to run as a Single Page Application (or SPA). This means that only the main page is loaded at the start and the views are then loaded on demand via AJAX calls.

Once a view is loaded and is no longer useful, it is hidden but not removed from the DOM (Document Object Model) of the main page. So if it is to be displayed later, it is not reloaded and is simply displayed again.

This behaviour can be changed under the following scenarios:

  • Access to your application is public (no authentication required to use it) and the main page is to reload each time a view is displayed : then configure your application with CFG_VIEW_PAGE_RELOAD set to TRUE.
  • If authentication is required, then for each view that needs to be reloaded on display, the zdk-viewreload CSS class must be added to any HTML element in the view (see Application views section).
  • The last option available is to load all views along with the main page. In that case, set the CFG_VIEW_PRELOAD PHP Constant to TRUE.


How to deploy my application on my internet hosting for use in real conditions?

Here is the procedure to deploy your Web App on a web hosting:

  1. Upload in FTP with FileZilla the ZnetDK installation directory content (eg from ./znetdk4m/ folder) to the web hosting target directory (eg in /home/www/znetdk4m).
  2. On Linux web hosting, make sure PHP has write access to the INSTALL_DIR/engine/log/ directory where the errors.log file is created and populated by ZnetDK when errors occur. Usually, the username under which PHP runs is www-data if Apache is installed. if necessary, use chmod and chown in command line to give write access to the user or group www-data on the INSTALL_DIR/engine/log/ directory.
  3. Check that the file .htaccess with statements Order deny,allow and Deny from all exists in the subfolders named app/ (see Folder tree of the Starter App) and mod/ (see Where are the modules installed?).
  4. Edit the root main script INSTALL_DIR/.htaccess and configure the ErrorDocument Apache directive for the HTTP errors 403 and 404 (see HTTP errors 403 and 404).
  5. If your Web Application stores its data in a MySQL database, make a full export of your local database from phpMyAdmin and import it in your web hosting database (in command line with mysqldump or from phpMyAdmin if installed).
  6. Configure the connection of your Web App to the MySQL database installed on your web hosting by editing the config.php script (see Database settings).