Joomla Predefined Constants

In this article, I will discuss Joomla predefined constants. When you are reading the Joomla docs you might not find all the constants that we can use when we are developing anything, for example, component, plugin, module or theme. Most of the constants are not mentioned in the Joomla docs because most of the constants are part of the third party libraries. I have found over 400 predefined constants of Joomla, but here I’ll discuss some important constants.

One important constant is _JEXEC that is used to ensure that files are accessed from a valid entry point or not, when anyone directly tries to access any file. So syntax for using this constant is given below:

[code type=”php”]

defined(‘_JEXEC’) or die(‘Restricted Access’);


Some other widely used Joomla constants are:

JPATH_CACHE (Cache Path, only used for Joomla template development).
JPATH_THEMES (Templates Path).
JPATH_LIBRARIES (Libraries Path).
JPATH_XMLRPC (Remote Web Services Application Path).
JPATH_ADMINISTRATOR (Root path to the JAdministrator application).
JPATH_CONFIGURATION (Configuration Path).
JPATH_SITE (Root path to the JSite Application).
JPATH_ROOT (Root path for the site).
JPATH_BASE (Remote path for the current application).
DS (Directory Separator, for example, / or \).

DATE_FORMAT_LC (Date format in the format of %A, %d %B %Y, for example, Monday, 24 July 2013
DATE_FORMAT_LC2 (Format: %A, %d %B %Y %H: %M).
DATE_FORMAT_LC3 (Format: %d %B %Y).
DATE_FORMAT_LC4 (Format: %d.%m.%y).

JPATH_COMPONENT_SITE (Frontend Component Path).
JPATH_COMPONENT (Component Path).

Duan Lingxin

Duan Lingxin

Content crafter and chief editor at Scratching Info. Also regular contributor on other major online tech platforms. Security Specialist by day and a writer by night, he does his best to instill his knowledge about tech while delivering inspiring and life changing resources through his writing,

More Posts - Website

Leave a Comment