-
Notifications
You must be signed in to change notification settings - Fork 1
Constants
The following constants are available if you are using the TemplateTools.
You can access each of this constants in PHP notation, i.e.:
<?php echo CMS_LOCALE; ?>
or within a Twig template as variable, i.e.:
{{ CMS_LOCALE }}
The TemplateTools provide you with constants for different purposes:
- CMS Constants
- Page Constants
- Template Constants
show_menu2()Constants- Browser Constants
- kitFramework Constants
- Extra Constants
CMS constants affect the whole Content Management System an not only a single page:
CMS_ADDONS_PATHCMS_ADDONS_URLCMS_DESCRIPTIONCMS_KEYWORDSCMS_LOCALECMS_LOGIN_ENABLEDCMS_LOGIN_FORGOTTEN_URLCMS_LOGIN_REDIRECT_URLCMS_LOGIN_SIGNUP_ENABLEDCMS_LOGIN_SIGNUP_URLCMS_LOGIN_URLCMS_LOGOUT_URLCMS_MAINTENANCE_MODECMS_MEDIA_PATHCMS_MEDIA_URLCMS_MODIFIED_BYCMS_MODIFIED_WHENCMS_PAGES_DIRECTORYCMS_PATHCMS_SEARCH_VISIBILITYCMS_TABLE_PREFIXCMS_TEMPLATES_PATHCMS_TEMPLATES_URLCMS_TITLECMS_TYPECMS_URLCMS_USER_ACCOUNT_URLCMS_USER_DISPLAYNAMECMS_USER_EMAILCMS_USER_GROUP_IDSCMS_USER_GROUP_NAMESCMS_USER_IDCMS_USER_IS_ADMINCMS_USER_IS_AUTHENTICATEDCMS_USER_USERNAMECMS_VERSION
Return the full path to the addons (module) directory.
Return the URL to the addons (module) directory.
Return the Website Description, defined in the CMS settings.
Return the Website Keywords, defined in the CMS settings.
Return the default locale for the Content Management System defined in the CMS settings in lowercase, i.e. de (German).
CMS_LOCALE is comparable to the WebsiteBaker constant DEFAULT_LANGUAGE.
Attention: This is not the locale for the current page!
See also: PAGE_LOCALE
Return boolean true if the frontend login is enabled - see settings in the backend: login -> enabled.
Return the URL to redirect the user to, if he had forgotten his password.
If CMS_LOGIN_ENABLED == false this constant will return the CMS_URL.
Return the URL to redirect the user after a successful login. This can be the start page but also the URL the user tried to access before he was authenticated.
Return boolean true if the frontend signup is enabled - see settings in the backend: sign-up -> member group.
Return the URL with the signup dialog.
If CMS_LOGIN_SIGNUP_ENABLED == false this constant will return the CMS_URL.
Return the URL for the login check.
If CMS_LOGIN_ENABLED == false this constant will return the CMS_URL.
Return the URL to logout the user.
If CMS_LOGIN_ENABLED == false this constant will return the CMS_URL.
Return true if the maintenance mode is activated.
You can use the maintenance mode to lock the website temporarily for visitors. Activate the maintenance mode by using the page_option() feature and set the option:
[maintenance:true]
to the keywords field of the Home page (the first page a visitor will see, identified by PAGE_ID_HOME.
To disable the maintenance mode remove the option or set the value to false:
[maintenance:false]
Example php:
The best place is at the top of your index.php:
<?php
// initialize the TemplateTools
require_once WB_PATH.'/kit2/extension/phpmanufaktur/phpManufaktur/TemplateTools/initialize.php';
if (!CMS_MAINTENANCE || (CMS_MAINTENANCE && CMS_USER_IS_ADMIN)) {
// show the template
$template['twig']->display('twig/template.twig');
}
else {
// show the maintenance message
$template['twig']->display('@pattern/bootstrap/maintenance.twig');
}
?>
In this example all visitors will see the maintenance screen, but a authenticated administrator has full access to the website an can implement, view and test all changes he want to process.
Return the full path to the media directory of the CMS.
Return the URL to the media directory of the CMS.
Return the displayname of the user who has last modified any page of the Content Management System (CMS).
Return the date and time for the last modification of any page of the Content Management System (CMS) in format Y-m-d H:i:s
See also: PAGE_MODIFIED_WHEN
Return the directory name for the CMS pages, by default this is /pages for WebsiteBaker and /page for LEPTON CMS and BlackCat CMS.
Return the full path to the root directory of the CMS.
This constant is comparable to the CMS constants WB_PATH, LEPTON_PATH or CAT_PATH.
See also: CMS_URL
Return the visibility of the CMS search function, possible values are: public, private, registered and none.
Return the MySQL table prefix which is used by the CMS, by default wb_, lep_ or cat_.
See also: FRAMEWORK_TABLE_PREFIX
Return the full path to the /templates directory of the CMS.
See also: TEMPLATE_PATH.
Return the URL to the /templates directory of the CMS.
See also: TEMPLATE_URL.
Return the Website Title, defined in the CMS settings.
Return the CMS type, the value can be WebsiteBaker, LEPTON or BlackCat.
See also: CMS_VERSION
Return the URL to the root directory of the CMS.
This constant is comparable to the CMS constants WB_URL, LEPTON_URL or CAT_URL.
Return the URL to the dialog to change the user account setting, the user must be authenticated to access this dialog.
If CMS_LOGIN_ENABLED == false this constant will return the CMS_URL.
Return the display name (full name) of the authenticated user or anonymous for any other user.
Return the email address of the authenticated user or an empty string for any other user.
If the user is authenticated this constant return a string with the comma separated group ID's to which the user belong to, otherwise an empty string.
Use the php function explode() or the twig Filter split to use this value as array.
If the user is authenticated this constant return a string with the comma separated group names to which the user belong to, otherwise an empty string.
Use the php function explode() or the twig Filter split to use this value as array.
Return the ID of the authenticated user or -1 for any other user.
Return true if the user is authenticated and has administrator permissions.
Return boolean true if the user is authenticated or false in any other case.
Return the username (the name for the login) of the authenticated user or anonymous in any other case.
Return the version number of the used CMS.
See also: CMS_TYPE
These constants describe the properties of the current page.
PAGE_DESCRIPTIONPAGE_EXTENSIONPAGE_FOOTERPAGE_HAS_CHILDPAGE_HEADERPAGE_IDPAGE_ID_HOMEPAGE_KEYWORDSPAGE_LOCALEPAGE_MENU_LEVELPAGE_MENU_TITLEPAGE_MODIFIED_BYPAGE_MODIFIED_WHENPAGE_PARENT_IDPAGE_TITLEPAGE_URLPAGE_VISIBILITY
Return the page description.
See also page_description().
Return the used page extension, including the dot. By default the extension is .php
Return the parsed page footer, defined in the CMS settings.
See also page_footer().
Return boolean true if the current page has a child or children and false if not.
Return the page header, defined in the CMS settings.
See also page_header().
Return the ID of the current page.
Return the PAGE_ID of the first, the home page.
Return the defined page keywords.
See also page_keywords().
Return the locale for the current page in lowercase, i.e. de for German.
This constant is comparable with the WebsiteBaker constant LANGUAGE.
See also: CMS_LOCALE
Return the actual level of the page in the menu structure, starting with 0 (top level).
Return the title defined for the menu.
Return the display name of the person who has at last changed the current page.
See also:
Return the date in format y-m-d H:i:s for the last change of the current page.
In php use the date() function to get a localized date and time format:
date($template['translator']->trans(DATETIME_FORMAT), PAGE_MODIFIED_WHEN);
in a Twig template use the date filter:
{{ PAGE_MODIFIED_WHEN|date(DATETIME_FORMAT|trans) }}
this will return for a German (de) localized page for example:
12.04.2014 - 12:32
See also:
Return the PAGE_ID of the parent for the current page. If the page has no parent (reside at top level) PAGE_PARENT_ID will return 0.
Return the title of the current page.
See also [[page_title()|CMS Service#page_title]].
Return the URL of the current page.
Return the visibility of the current page, this can be:
-
public- visible for everyone -
private- only for the author of the page -
hidden- hidden (not listed in the navigation) -
registered- only for registered users -
none- none, will not shown
These constants describe the template:
Return the template name of the as default defined template.
Return the directory name where the actual template reside.
Return the name of the actual template.
Return the full path to the actual template.
Return the URL to the actual template.
These constants are used by show_menu2() and generally available in all php scripts. The TemplateTools make these constants also available in all Twig template files *.twig.
SM2_ALLSM2_ALLINFOSM2_ALLMENUSM2_BUFFERSM2_COND_TERMSM2_CONDITIONALSM2_CRUMBSM2_CURRSM2_CURRTREESM2_ESCAPESM2_MAXSM2_NO_TITLESM2_NOCACHESM2_NOESCAPESM2_NUMCLASSSM2_PRETTYSM2_ROOTSM2_SHOWHIDDENSM2_SIBLINGSM2_STARTSM2_TRIMSM2_XHTML_STRICT
Please have a look to the show_menu2() documentation to get more information about the usage of show_menu2().
ATTENTION: show_menu2() is using the bitwise or Operator | (pipe) to combine flags. You can not use the pipe | as bitwise or Operator in Twig, you must use b-or instead!
Example, if you need something like:
{{ show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_NUMCLASS|SM2_PRETTY) }}
you must use instead:
{{ show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL b-or SM2_NUMCLASS b-or SM2_PRETTY) }}
See also [[CMS Service show_menu2()|CMS Service#show_menu2]]
These constants are used by the Browser Service.
Identify the used Browser:
-
BROWSER_AMAYA=> Amaya -
BROWSER_ANDROID=> Android -
BROWSER_BINGBOT=> Bing Bot -
BROWSER_BLACKBERRY=> BlackBerry -
BROWSER_CHROME=> Chrome -
BROWSER_FIREBIRD=> Firebird -
BROWSER_FIREFOX=> Firefox -
BROWSER_GALEON=> Galeon -
BROWSER_GOOGLEBOT=> GoogleBot -
BROWSER_ICAB=> iCab -
BROWSER_ICECAT=> IceCat -
BROWSER_ICEWEASEL=> Iceweasel -
BROWSER_IE=> Internet Explorer -
BROWSER_IPAD=> iPad -
BROWSER_IPHONE=> iPhone -
BROWSER_IPOD=> iPod -
BROWSER_KONQUEROR=> Konqueror -
BROWSER_LYNX=> Lynx -
BROWSER_MOZILLA=> Mozilla -
BROWSER_MSN=> MSN Browser -
BROWSER_MSNBOT=> MSN Bot -
BROWSER_NETPOSITIVE=> NetPositive -
BROWSER_NETSCAPE_NAVIGATOR=> Netscape Navigator -
BROWSER_NOKIA=> Nokia Browser -
BROWSER_NOKIA_S60=> Nokia S60 OSS Browser -
BROWSER_OMNIWEB=> OmniWeb -
BROWSER_OPERA=> Opera -
BROWSER_OPERA_MINI=> Opera Mini -
BROWSER_PHOENIX=> Phoenix -
BROWSER_POCKET_IE=> Pocket Internet Explorer -
BROWSER_SAFARI=> Safari -
BROWSER_SHIRETOKO=> Shiretoko -
BROWSER_SLURP=> Yahoo! Slurp -
BROWSER_UNKNOWN=> unknown -
BROWSER_W3CVALIDATOR=> W3C Validator -
BROWSER_WEBTV=> WebTV
Identifiy the used platform:
-
PLATFORM_ANDROID=> Android -
PLATFORM_APPLE=> Apple -
PLATFORM_BEOS=> BeOS -
PLATFORM_BLACKBERRY=> BlackBerry -
PLATFORM_FREEBSD=> FreeBSD -
PLATFORM_IPAD=> iPad -
PLATFORM_IPHONE=> iPhone -
PLATFORM_IPOD=> iPod -
PLATFORM_LINUX=> Linux -
PLATFORM_NETBSD=> NetBSD -
PLATFORM_NOKIA=> Nokia -
PLATFORM_OS2=> OS/2 -
PLATFORM_OPENBSD=> OpenBSD -
PLATFORM_OPENSOLARIS=> OpenSolaris -
PLATFORM_SUNOS=> SunOS -
PLATFORM_UNKNOWN=> unknown -
PLATFORM_WINDOWS=> Windows -
PLATFORM_WINDOWS_CE=> Windows CE
These constants are assigned to the kitFramework and enable you to access many additional features for your Content Management System:
EXTENSION_PATHEXTENSION_URLFRAMEWORK_CACHEFRAMEWORK_DEBUGFRAMEWORK_MEDIA_PATHFRAMEWORK_MEDIA_URLFRAMEWORK_PATHFRAMEWORK_TABLE_PREFIXFRAMEWORK_URLHELPER_PATHHELPER_URLLIBRARY_PATHLIBRARY_URLMANUFAKTUR_PATHMANUFAKTUR_URLTHIRDPARTY_PATHTHIRDPARTY_URL
The full path to the kitFramework Library php extensions, these are i.e. Carbon (Date & Time functions) or the HTML Purifier (Standards-Compliant HTML Filtering) and many other extensions.
See also: EXTENSION_URL
The URL to the kitFramework Library php extensions.
See also: EXTENSION_PATH
If you are using the Twig Template Engine and the cache is enabled, all *.twig templates will be precompiled and directly loaded from the cache - this will speed up the output because the files are not parsed and compiled at each access.
By default the FRAMEWORK_CACHE is enabled and set to true.
While creating your template, the cache may ignore smaller changes, so switch off the cache when you are working at your templates.
The settings for the cache are defined in the framework.json configuration file.
You can override the settings if you define the FRAMEWORK_CACHE just before initializing the TemplateTools:
define('FRAMEWORK_DEBUG', true);
define('FRAMEWORK_CACHE', false);
require_once WB_PATH.'/kit2/extension/phpmanufaktur/phpManufaktur/TemplateTools/initialize.php';
See also: FRAMEWORK_DEBUG
If you are using the Twig Template Engine and the debug mode is enabled, Twig will check all variables in a strict mode and enable the additional Twig debugging functions like {{ dump() }}.
By default FRAMEWORK_DEBUG is disabled and set to false.
While you are developing your template, you should switch on the debugging mode.
The settings for the debugging are defined in the framework.json configuration file.
You can override the settings if you define the FRAMEWORK_DEBUG just before initializing the TemplateTools:
define('FRAMEWORK_DEBUG', true);
define('FRAMEWORK_CACHE', false);
require_once WB_PATH.'/kit2/extension/phpmanufaktur/phpManufaktur/TemplateTools/initialize.php';
See also: FRAMEWORK_CACHE
Return the full path to the public kitFramework media directory:
FRAMEWORK_PATH./media/public
See also: FRAMEWORK_MEDIA_URL, FRAMEWORK_PATH
Return the URL to the public kitFramework media directory:
FRAMEWORK_URL./media/public
See also: FRAMEWORK_MEDIA_PATH, FRAMEWORK_URL
Return the full path to the kitFramework root directory.
See also: FRAMEWORK_URL
Return the MySQL table prefix which is used by the kitFramework.
See also: CMS_TABLE_PREFIX
Return the URL to the kitFramework root.
See also: FRAMEWORK_PATH
Return the full path to the kitFramework Library /Helper directory, which contains general helpers, i.e. for Bootstrap.
See also: HELPER_URL
Return the URL to the kitFramework Library /Helper directory, which contains general helpers, i.e. for Bootstrap.
See also: HELPER_PATH
Return the full path to the kitFramework Library /Library directory, which contains different libraries, i.e. for jQuery, Bootstrap, Font Awesome and many other.
See also: LIBRARY_URL
Return the URL to the kitFramework Library /Library directory, which contains different libraries, i.e. for jQuery, Bootstrap, Font Awesome and many other.
See also: LIBRARY_PATH
Return the full path to the kitFramework directory, which contains the different extensions of the phpManufaktur for the kitFramework, i.e. the TemplateTools.
See also: MANUFAKTUR_URL
Return the URL to the kitFramework directory, which contains the different extensions of the phpManufaktur for the kitFramework, i.e. the TemplateTools.
See also: MANUFAKTUR_PATH
Return the full path to the kitFramework directory, which contains different extensions from third party vendors for the kitFramework.
See also: THIRDPARTY_URL
Return the URL to the kitFramework directory, which contains different extensions from third party vendors for the kitFramework.
See also: THIRDPARTY_PATH
The EXTRA_xxx constants are used for special purposes.
If the current page contains a flexContent article the EXTRA_FLEXCONTENT_ID return the ID of this flexContent article, i.e. for a database access. In any other case the EXTRA_FLEXCONTENT_ID will return -1.
If the current page contain a News article, the EXTRA_POST_ID return the ID of this News article, i.e. for a database access or to set the page title. In any other case, the EXTRA_POST_ID will return -1.
If the current page contain a Topics article, the EXTRA_TOPIC_ID contain the ID of this Topics article, i.e. for a database access or to set the page title. In any other case, the EXTRA_TOPIC_ID will return -1.
- If you spot a typo or want to contribute an article, a how-to or a tip, feel free to edit the Wiki directly
- If you you have any questions, please visit the phpManufaktur Support Forum
This Documentation is part of the kitFramework Project
© 2014 by phpManufaktur, kitFramework and TemplateTools are published under MIT license.