Marmot Manual

Chapter 6. The Application.php file

It is not uncommon to have configuration settings, security checking, or other tasks that must be performed on every page of your application. Marmot provides a mechanism by which this code is automatically loaded from a single shared file.

When any page is requested, the Marmot startup process looks for a file named "Application.php" (it is case sensitive) starting in the current directory. It then includes the first such file it finds. The search terminates at the application directory, as defined by the environment constant fspath_webapp_dir.

You may place any valid PHP code in the Application.php file. For example:

<?php include_once('common/navigation_menu.php'); $cfg_appdir = 'my_app'; $cfg_webhome = mu_env_get('webpath_webapp_dir') . mu_env_get('webpath_webapp_dir') . '/' . $cfg_appdir; $cfg_marmot_version = mu_env_get('version'); $cfg_sessionname = 'MYAPP'; $cfg_appname = 'My Application'; start_session($cfg_sessionname); ?>