Constants and Globals
A number of constants and properties are made available across PyroCMS.
PHP Constants
Name | Outputs | Description |
---|---|---|
ADDONPATH | addons/default/ | The path to third-party addons. |
APPPATH | system/cms/ | The path to the application folders. |
APPPATH_URI | system/cms/ | The path to the application folders but with a leading slash. |
BASE_URL | http://site.com/ | The equivalent to CodeIgniter's base_url(). Does not change with or without mod_rewrite. |
BASE_URI | / | The relative root. |
CURRENT_LANGUAGE | en | Outputs the two digit language code of the currently selected language. |
FCPATH | /var/www/site_folder/ | The path to index.php |
ADMIN_THEME | pyrocms | Outputs the slug of the admin theme that is currently in use. |
SHARED_ADDONPATH | addons/shared_addons/ | The path to add-ons that are shared between all sites. Add-ons are also available to the default site in the free version. |
SITE_REF | default | Can be used to find which site is currently running. Cannot be used inside module install or uninstall logic as it will break in multi-site. Use $this->site_ref there for complete compatibility. |
UPLOAD_PATH | uploads/default/ | The path to the current site's uploads. Cannot be used inside module install or uninstall logic as it will break in multi-site. Use $this->upload_path there for complete compatibility. |
PHP Global Variables
Name | Outputs | Description |
---|---|---|
$this->controller | admin, blog, rss, etc | The name of the current controller. |
$this->method | index, create, etc | The name of the current method. |
$this->module | blog | The slug of the current module or an empty string if the current page is the dashboard, login, etc. |
$this->permissions | array | A list of modules that the user is allowed to access. If roles are defined for a module it will contain an object of role permissions. |
$this->current_user | an object | All user information (groups, users, and profiles tables) of the current user or an empty array if not logged in. |
$this->theme_options | an object | All theme options for the current admin theme. Can be used like $this->theme_options->news_feed. Professional version only. |
$this->site_ref | default | This is available only in a module's details.php file. Elsewhere in your module use SITE_REF |
$this->upload_path | uploads/default/ | This is available only in a module's details.php file. Elsewhere in your module use UPLOAD_PATH |
JavaScript Global Variables
Name | Outputs | Available | Description |
---|---|---|---|
APPPATH_URI | system/cms/ | admin and front-end | The path to the system folder |
BASE_URI | / | admin and front-end | The relative root. |
BASE_URL | http://site.com | admin | The site address. Unaffected by mod_rewrite. |
DEFAULT_TITLE | Un-named Website | admin | The site name. |
DIALOG_MESSAGE | Are you sure you want to delete this? It cannot be undone. | admin | The delete warning message in the current language. If you add your own message to the button's title attribute it will be used instead. |
SITE_URL | http://site.com/ or http://site.com/index.php/ | admin | Changes depending on mod_rewrite settings. Identical to CodeIgniter's site_url() |
UPLOAD_PATH | uploads/default/ | admin | The path to the current site's uploaded files. |