Greek English
You are here Home » Developers » Core features » PHP constants

PHP constants

Last update by Elxis Team

PHP constants Elxis defines on boot time.

On boot time Elxis defines a few PHP constants. Some of them are only available under special circumstances.

Always available PHP constants

_ELXIS_ If this is not set elxis dies. It is used to avoid direct request to internal PHP files. We should check if it exists on the very top of all included PHP files.

defined('_ELXIS_') or die ('Direct access to this location is not allowed');

ELXIS_PATH The absolute path to the Elxis root folder. No trailing slash at the end, forward slashes even if Elxis runs under windows!
ELXIS_SELF The accessed elxis file name (index.php or inner.php)
ELXIS_INNER If the page was acccess via inner.php (or other limited functionality file) this is 1 else it is 0. If it is 1 then the special inner.php template file is loaded and no modules.
ELXIS_OS A short abbreviation of the operating system under which Elxis runs. Values are: WIN (Windows), MAC (Macintos) or LIN (Linux/Unix).
ELXIS_MOBILE (since Elxis 4.1) If 1, elxis generates a mobile version of the site. If 0, a PC version. ELXIS_MOBILE can be 1 only if MOBILE configuration option has been set to 1 (enable site version for handheld devices) and only in front-end section.
DS Directory separator. Shortcut for the standard PHP constant DIRECTORY_SEPARATOR
_LEND Line end. Depending on the OS it can be (displayed without backslashes) rn (Windows), r (Mac) or n (Linux/Unix).


Constants only available under special circumstances

ELXIS_MULTISITE If multisites are enabled, this constant has as value the ID (integrer) of the current site.
ELXIS_CATID The currently displayed category ID (catid). Available on content category pages.
ELXIS_ARTID The currently displayed article ID (id). Available on content articles pages.


Constants only available in administration area

ELXIS_ADMIN If is set then the user has requested an administration page.
ELXIS_APATH The absolute path to the Elxis administration root folder. No trailing slash at the end, forward slashes even if Elxis runs under windows!
ELXIS_ADIR The name of the administration folder. (Note: administration folder can be renamed! The default name is estia)

It has been read 4776 times
Dependencies
Previous article
Dependencies

You are free to copy, distribute and transmit the articles in this site for non-commercial purposes.
Creative Commons 3.0