UNA
BxDolTemplate Class Reference
Inheritance diagram for BxDolTemplate:
BxDolFactory iBxDolSingleton BxDolModuleTemplate BxDolStudioTemplate BxAnonFollowTemplate BxAntispamTemplate BxApiTemplate BxBaseModGeneralTemplate BxChatPlusTemplate BxContactTemplate BxDataFoxTemplate BxEditorTemplate BxFontAwesomeTemplate BxFroalaTemplate BxGoogleTagManTemplate BxIntercomTemplate BxMailchimpTemplate BxMarkerIoTemplate BxNewCommentsTemplate BxNexusTemplate BxOpencvTemplate BxPlyrTemplate BxProfilerTemplate BxQuoteOfDayTemplate BxSMTPTemplate BxWikiTemplate

Public Member Functions

 __clone ()
 
 collectingStart ()
 
 collectingEndGetCode ($aExcludeCss=array(), $aExcludeJs=array(), $sFormat='html')
 
 loadTemplates ()
 
 init ()
 
 setPageNameIndex ($i)
 
 setPageNameIndexByTarget ($s)
 
 getPageNameIndex ()
 
 setPageType ($i)
 
 setPageUrl ($s)
 
 getPageType ()
 
 setPageHeader ($s)
 
 getPageHeader ()
 
 setPageParams ($a)
 
 getPageParams ()
 
 setPageMetaTitle ($sTitle)
 
 setPageDescription ($sDescription)
 
 setPageMetaRobots ($s)
 
 setPageInjections ($aInjections)
 
 setPageContent ($sVar, $sContent, $iIndex=false)
 
 getPageContent ($sVar=false, $iIndex=false)
 
 getName ()
 
 getCssClassName ()
 
 getCode ()
 
 getEmbed ($sContent)
 
 getCodeKey ()
 
 getMix ()
 
 getPath ()
 
 setPageTitle ($sTitle)
 
 setPageMainBoxTitle ($sTitle)
 
 isLocation ($sKey)
 
 getLocations ()
 
 addLocation ($sKey, $sLocationPath, $sLocationUrl)
 
 addDynamicLocation ($sLocationPath, $sLocationUrl)
 
 removeLocation ($sKey)
 
 isLocationJs ($sKey)
 
 addLocationJs ($sKey, $sLocationPath, $sLocationUrl)
 
 addDynamicLocationJs ($sLocationPath, $sLocationUrl)
 
 removeLocationJs ($sKey)
 
 addJsOption ($mixedName)
 
 addJsTranslation ($mixedKey, $bDynamic=false)
 
 addJsImage ($aImages)
 
 addJsIcon ($aIcons)
 
 addCssStyle ($sName, $sContent)
 
 addPageKeywords ($mixedKeywords, $sDevider=',')
 
 addPageMetaLocation ($fLat, $fLng, $sCountryCode)
 
 addPageMetaImage ($sImageUrl)
 
 addPageRssLink ($sTitle, $sUrl)
 
 getMetaInfo ()
 
 getTemplate ($sName)
 
 getTemplateFunctions ()
 
 getImageMimeType ($sExtension)
 
 getIcon ($mixedId, $aParams=array())
 
 getImage ($mixedId, $aParams=array())
 
 getIconUrl ($sName, $sCheckIn=BX_DOL_TEMPLATE_CHECK_IN_BOTH)
 
 getIconPath ($sName, $sCheckIn=BX_DOL_TEMPLATE_CHECK_IN_BOTH)
 
 getImageAuto ($sName, $bWrapped=true, $sCheckIn=BX_DOL_TEMPLATE_CHECK_IN_BOTH)
 
 getImageUrl ($sName, $sCheckIn=BX_DOL_TEMPLATE_CHECK_IN_BOTH)
 
 getImagePath ($sName, $sCheckIn=BX_DOL_TEMPLATE_CHECK_IN_BOTH)
 
 getCssUrl ($sName, $sCheckIn=BX_DOL_TEMPLATE_CHECK_IN_BOTH)
 
 getCssPath ($sName, $sCheckIn=BX_DOL_TEMPLATE_CHECK_IN_BOTH)
 
 getJsUrl ($sName)
 
 getJsPath ($sName)
 
 getTemplateUrl ($sName, $sCheckIn=BX_DOL_TEMPLATE_CHECK_IN_BOTH)
 
 getTemplatePath ($sName, $sCheckIn=BX_DOL_TEMPLATE_CHECK_IN_BOTH)
 
 getMenu ($s)
 
 isHtml ($sName, $sCheckIn=BX_DOL_TEMPLATE_CHECK_IN_BOTH)
 
 getHtml ($sName, $sCheckIn=BX_DOL_TEMPLATE_CHECK_IN_BOTH)
 
 parseHtmlByName ($sName, $aVariables, $mixedKeyWrapperHtml=null, $sCheckIn=BX_DOL_TEMPLATE_CHECK_IN_BOTH)
 
 parseHtmlByContent ($sContent, $aVariables, $mixedKeyWrapperHtml=null)
 
 parseHtmlByTemplateName ($sName, $aVariables, $mixedKeyWrapperHtml=null)
 
 parsePageByName ($sName, $aVariables)
 
 parseSystemKey ($sKey, $mixedKeyWrapperHtml=null, $bProcessInjection=true)
 
 parseLink ($sLink, $sContent, $aAttrs=array())
 
 parseLinkByName ($sName, $sLink, $sContent, $aAttrs=array())
 
 parseButton ($sContent, $aAttrs=array())
 
 parseImage ($sLink, $aAttrs=array())
 
 parseIcon ($sName, $aAttrs=array())
 
 getTemplatesCacheObject ()
 
 getCached ($sName, &$aVariables, $mixedKeyWrapperHtml=null, $sCheckIn=BX_DOL_TEMPLATE_CHECK_IN_BOTH, $bEvaluate=true)
 
 addJs ($mixedFiles, $bDynamic=false)
 
 getJs ()
 
 addJsSystem ($mixedFiles)
 
 deleteJs ($mixedFiles)
 
 deleteJsSystem ($mixedFiles)
 
 _compileJs ($sAbsolutePath, &$aIncluded)
 
 _minifyJs ($s)
 
 _wrapInTagJs ($sFile)
 
 _wrapInTagJsCode ($sCode)
 
 addCss ($mixedFiles, $bDynamic=false)
 
 getCss ()
 
 addCssAsync ($mixedFiles)
 
 includeCssAsync ()
 
 addCssSystem ($mixedFiles)
 
 deleteCss ($mixedFiles)
 
 deleteCssSystem ($mixedFiles)
 
 _compileCss ($sAbsolutePath, &$aIncluded)
 
 _lessCss ($mixed)
 
 _minifyCss ($s)
 
 _wrapInTagCss ($sFile)
 
 _wrapInTagCssCode ($sCode)
 
 includeCssStyles ()
 
 includeFiles ($sType, $bSystem=false, $bWrap=true)
 
 _includeFiles ($sType, &$aFiles, $bWrap=true)
 
 _processFiles ($sType, $sAction, $mixedFiles, $bDynamic=false, $bSystem=false)
 
 _parseContent ($sContent, $aVariables, $mixedKeyWrapperHtml=null)
 
 _compileContent ($sContent, $aVarName, $iVarDepth, $aVarValues, $mixedKeyWrapperHtml=null)
 
 _getAbsoluteLocation ($sType, $sFolder, $sName, $sCheckIn=BX_DOL_TEMPLATE_CHECK_IN_BOTH)
 
 _getAbsoluteLocationJs ($sType, $sName)
 
 _getInlineData ($sType, $sName, $sCheckIn)
 
 _getCacheFileName ($sType, $sAbsolutePath)
 
 _getKeyWrappers ($mixedKeyWrapperHtml)
 
 _processJsTranslations ()
 
 _processJsOptions ()
 
 _processJsImages ()
 
 _getLoaderUrl ($sType, $sName)
 
 getRevision ()
 
 addRevision ($sUrl)
 
 displayAccessDenied ($sMsg='', $iPage=BX_PAGE_DEFAULT, $iDesignBox=BX_DB_PADDING_DEF)
 
 processInjection ($iPageIndex, $sKey, $sValue="")
 
 addInjection ($sKey, $sType, $sData, $iReplace=0)
 

Static Public Member Functions

static getInstance ()
 
static retrieveCode ($sCodeKey=BX_DOL_TEMPLATE_CODE_KEY, $sMixKey=BX_DOL_TEMPLATE_MIX_KEY, $sRootPath=BX_DIRECTORY_PATH_ROOT)
 

Protected Member Functions

 __construct ($sRootPath=BX_DIRECTORY_PATH_ROOT, $sRootUrl=BX_DOL_URL_ROOT)
 

Protected Attributes

 $_sName
 
 $_bCacheEnable
 

Detailed Description

Template engine.

An object of the class allows to:

  1. Manage HTML templates.
  2. Get URL/path for any template image/icon.
  3. Attach CSS/JavaScript files to the output.
  4. Add some content to any template key using Injection engine.

Avalable constructions.

  1. <bx_include_auto:template_name.html /> - the content of the file would be inserted. File would be taken from current template if it existes there, and from base directory otherwise.
  2. <bx_include_base:template_name.html /> - the content of the file would be inserted. File would be taken from base directory.
  3. <bx_include_tmpl:template_name.html /> - the content of the file would be inserted. File would be taken from tmpl_xxx directory.
  4. <bx_url_root /> - the value of BX_DOL_URL_ROOT variable will be inserted.
  5. <bx_url_admin /> - the value of BX_DOL_URL_ADMIN variable will be inserted.
  6. <bx_text:_language_key /> - _language_key will be translated using language file(function _t()) and inserted. <bx_text_js:_language_key /> - _language_key will be translated using language file(function _t()) and inserted, use it to insert text into js string. <bx_text_attribute:_language_key /> - _language_key will be translated using language file(function _t()) and inserted, use it to insert text into html attribute.
  7. <bx_image_url:image_file_name /> - image with 'image_file_name' file name will be searched in the images folder of current template. If it's not found, then it will be searched in the images folder of base template. On success full URL will be inserted, otherwise an empty string.
  8. <bx_icon_url:icon_file_name /> - the same with <bx_image_url:image_file_name />, but icons will be searched in the images/icons/ folders.
  9. <bx_injection:injection_name /> - will be replaced with injections registered with the page and injection_name in the sys_injections/sys_injections_admin/ tables.
  10. <bx_if:tag_name>some_HTML</bx_if:tag_name> - will be replaced with provided content if the condition is true, and with empty string otherwise.
  11. <bx_repeat:cycle_name>some_HTML</bx_repeat:cycle_name> - an inner HTML content will be repeated in accordance with received data.

Related classes: BxDolTemplateAdmin - for processing admin templates. Template classes in modules - for processing modiles' templates.

Global variables: oSysTemplate - is used for template processing in user part. oAdmTemplate - is used for template processing in admin part.

Add injection:

  1. Register it in the sys_injections table or sys_injections_admin table for admin panel.
  2. Clear injections cache(sys_injections.inc and sys_injections_admin.inc in cache folder).

Predefined template keys to add injections:

  1. injection_head - add injections in the <head> tag.
  2. injection_body - add ingection(attribute) in the <body> tag.
  3. injection_header - add injection inside the <body> tag at the very beginning.
  4. injection_logo_before - add injection at the left of the main logo(inside logo's DIV).
  5. injection_logo_after - add injection at the right of the main logo(inside logo's DIV).
  6. injection_between_logo_top_menu - add injection between logo and top menu.
  7. injection_top_menu_before - add injection at the left of the top menu(inside top menu's DIV).
  8. injection_top_menu_after - add injection at the right of the top menu(inside top menu's DIV).
  9. injection_content_before - add injection just before main content(inside content's DIV).
  10. injection_content_after - add injection just after main content(inside content's DIV).
  11. injection_between_content_footer - add injection between content and footer.
  12. injection_footer_before - add injection at the left of the footer(inside footer's DIV).
  13. injection_footer_after - add injection at the right of the footer(inside footer's DIV).
  14. injection_footer - add injection inside the <body> tag at the very end.

Example of usage:

$oSysTemplate = BxDolTemplate::getInstance();
$oSysTemplate->addCss(array('test1.css', 'test2.css'));
$oSysTemplate->addJs(array('test1.js', 'test2.js'));
$oSysTemplate->parseHtmlByName('messageBox.html', array(
'id' => $iId,
'msgText' => $sText,
'bx_if:timer' => array(
'condition' => $iTimer > 0,
'content' => array(
'id' => $iId,
'time' => 1000 * $iTimer,
'on_close' => $sOnClose,
)
),
'bx_if:timer' => array(
array(
'name' => $sName,
'title' => $sTitle
),
array(
'name' => $sName,
'title' => $sTitle
)
)
));

Memberships/ACL: Doesn't depend on user's membership.

Alerts: no alerts available

Constructor & Destructor Documentation

◆ __construct()

BxDolTemplate::__construct (   $sRootPath = BX_DIRECTORY_PATH_ROOT,
  $sRootUrl = BX_DOL_URL_ROOT 
)
protected

Constructor

Member Function Documentation

◆ __clone()

BxDolTemplate::__clone ( )

Prevent cloning the instance

◆ _compileContent()

BxDolTemplate::_compileContent (   $sContent,
  $aVarName,
  $iVarDepth,
  $aVarValues,
  $mixedKeyWrapperHtml = null 
)

Compile content

Parameters
string$sContenttemplate.
string$aVarNamevariable name to be saved in the output file.
integer$iVarDepthdepth is used to process nesting, for example, in cycles.
array$aVarValuesvalues to be compiled in.
mixed$mixedKeyWrapperHtmlkey wrapper(string value if left and right parts are the same, array(0 => left, 1 => right) otherwise).
Returns
string the result of operation.

◆ _compileCss()

BxDolTemplate::_compileCss (   $sAbsolutePath,
$aIncluded 
)

Compile CSS files' structure(

See also
@import css_file_path) in one file.
Parameters
string$sAbsolutePathCSS file absolute path(full URL for external CSS/JS files).
array$aIncludedan array of already included CSS files.
Returns
string result of operation.

◆ _compileJs()

BxDolTemplate::_compileJs (   $sAbsolutePath,
$aIncluded 
)

Compile JS files in one file.

Parameters
string$sAbsolutePathCSS file absolute path(full URL for external CSS/JS files).
array$aIncludedan array of already included JS files.
Returns
string result of operation.

◆ _getAbsoluteLocation()

BxDolTemplate::_getAbsoluteLocation (   $sType,
  $sFolder,
  $sName,
  $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH 
)

Get absolute location of some template's part.

Parameters
string$sType- result type. Available values 'url' and 'path'.
string$sFolder- folders to be searched in.
See also
$_sFolderHtml, $_sFolderCss, $_sFolderImages and $_sFolderIcons
Parameters
string$sName- requested part name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string absolute location (path/url) of the part.

Module(mod) related locations will be checked first in TMPL and BASE, then system(sys) location(s) will be checked in TMPL and BASE.

try to find from received path

◆ _getAbsoluteLocationJs()

BxDolTemplate::_getAbsoluteLocationJs (   $sType,
  $sName 
)

Get absolute location of some template's part.

Parameters
string$sTyperesult type. Available values 'url' and 'path'.
string$sNamerequested part name.
Returns
string absolute location (path/url) of the part.

◆ _getCacheFileName()

BxDolTemplate::_getCacheFileName (   $sType,
  $sAbsolutePath 
)

Get file name where the template would be cached.

Parameters
string$sAbsolutePathtemplate's real path.
Returns
string the result of operation.

◆ _getInlineData()

BxDolTemplate::_getInlineData (   $sType,
  $sName,
  $sCheckIn 
)

Get inline data for Images and Icons.

Parameters
string$sTypeimage/icon
string$sNamefile name
string$sCheckInwhere the content would be searched(base, template, both)
Returns
unknown

◆ _getKeyWrappers()

BxDolTemplate::_getKeyWrappers (   $mixedKeyWrapperHtml)

Get template key wrappers(left, right)

Parameters
mixed$mixedKeyWrapperHtmlkey wrapper(string value if left and right parts are the same, array(0 => left, 1 => right) otherwise).
Returns
array result of operation.

◆ _getLoaderUrl()

BxDolTemplate::_getLoaderUrl (   $sType,
  $sName 
)

Get Gzip loader URL.

Parameters
$sTypecontent type CSS/JS
$sNamefile name.
Returns
string with URL

◆ _includeFiles()

BxDolTemplate::_includeFiles (   $sType,
$aFiles,
  $bWrap = true 
)

Include CSS/JS files without caching.

Parameters
string$sTypethe file type (css or js)
array$aFilesCSS/JS files to be added to the page.
Returns
string result of operation.

◆ _lessCss()

BxDolTemplate::_lessCss (   $mixed)

Less CSS

Parameters
mixed$mixedCSS string to process with Less compiler or an array with CSS file's Path and URL.
Returns
mixed string or an array with CSS file's Path and URL.

◆ _minifyCss()

BxDolTemplate::_minifyCss (   $s)

Minify CSS

Parameters
string$sCSS string to minify
Returns
string minified CSS string.

◆ _minifyJs()

BxDolTemplate::_minifyJs (   $s)

Minify JS

Parameters
string$sJS string to minify
Returns
string minified JS string.

◆ _parseContent()

BxDolTemplate::_parseContent (   $sContent,
  $aVariables,
  $mixedKeyWrapperHtml = null 
)

Parse content.

Parameters
string$sContent- HTML file's content.
array$aVariables- key/value pairs. key should be the same as template's key, but without prefix and postfix.
mixed$mixedKeyWrapperHtml- key wrapper(string value if left and right parts are the same, array(0 => left, 1 => right) otherwise).
Returns
string the result of operation.

◆ _processFiles()

BxDolTemplate::_processFiles (   $sType,
  $sAction,
  $mixedFiles,
  $bDynamic = false,
  $bSystem = false 
)

Insert/Delete CSS file from output stack.

Parameters
string$sTypethe file type (css or js)
string$sActionadd/delete
mixed$mixedFilesstring value represents a single CSS file name. An array - array of CSS file names.
Returns
boolean result of operation.

◆ _processJsImages()

BxDolTemplate::_processJsImages ( )

Process all added images and return them as a string.

Returns
string with JS code.

◆ _processJsOptions()

BxDolTemplate::_processJsOptions ( )

Process all added options and return them as a string.

Returns
string with JS code.

◆ _processJsTranslations()

BxDolTemplate::_processJsTranslations ( )

Process all added language translations and return them as a string.

Returns
string with JS code.

◆ _wrapInTagCss()

BxDolTemplate::_wrapInTagCss (   $sFile)

Wrap an URL to CSS file into CSS tag.

Parameters
string$sFile- URL to CSS file.
Returns
string the result of operation.

◆ _wrapInTagCssCode()

BxDolTemplate::_wrapInTagCssCode (   $sCode)

Wrap CSS code into CSS tag.

Parameters
string$sCode- CSS code.
Returns
string the result of operation.

◆ _wrapInTagJs()

BxDolTemplate::_wrapInTagJs (   $sFile)

Wrap an URL to JS file into JS tag.

Parameters
string$sFile- URL to JS file.
Returns
string the result of operation.

◆ _wrapInTagJsCode()

BxDolTemplate::_wrapInTagJsCode (   $sCode)

Wrap JS code into JS tag.

Parameters
string$sCode- JS code.
Returns
string the result of operation.

◆ addCss()

BxDolTemplate::addCss (   $mixedFiles,
  $bDynamic = false 
)

Add CSS file(s) to global output.

Parameters
mixed$mixedFilesstring value represents a single CSS file name. An array - array of CSS file names.
boolean$bDynamicin the dynamic mode CSS file(s) are not included to global output, but are returned from the function directly.
Returns
boolean/string result of operation

◆ addCssAsync()

BxDolTemplate::addCssAsync (   $mixedFiles)

Add additional heavy css file (not very necessary) to load asynchronously for desktop browsers only

Parameters
mixed$mixedFilesstring value represents a single CSS file name. An array - array of CSS file names.

◆ addCssStyle()

BxDolTemplate::addCssStyle (   $sName,
  $sContent 
)

Add CSS style.

Parameters
string$sNameCSS class name.
string$sContentCSS class styles.

◆ addCssSystem()

BxDolTemplate::addCssSystem (   $mixedFiles)

Add System CSS file(s) to global output. System CSS files are the files which are attached to all pages. They will be cached separately from the others.

Parameters
mixed$mixedFilesstring value represents a single CSS file name. An array - array of CSS file names.
Returns
boolean/string result of operation

◆ addDynamicLocation()

BxDolTemplate::addDynamicLocation (   $sLocationPath,
  $sLocationUrl 
)

Add dynamic location.

Parameters
string$sLocationPath- location's path. For modules: '[path_to_script]/modules/[vendor_name]/[module_name]/'
string$sLocationUrl- location's url. For modules: '[url_to_script]/modules/[vendor_name]/[module_name]/'
Returns
location key. Is needed to remove the location.

◆ addDynamicLocationJs()

BxDolTemplate::addDynamicLocationJs (   $sLocationPath,
  $sLocationUrl 
)

Add dynamic JS location.

Parameters
string$sLocationPath- location's path. For modules: '[path_to_script]/modules/[vendor_name]/[module_name]/'
string$sLocationUrl- location's url. For modules: '[url_to_script]/modules/[vendor_name]/[module_name]/'
Returns
location key. Is needed to remove the location.

◆ addInjection()

BxDolTemplate::addInjection (   $sKey,
  $sType,
  $sData,
  $iReplace = 0 
)

Static method to add ingection available on the current page only.

Parameters
string$sKey- template's key.
string$sType- injection type(text, php).
string$sData- the data to be added.
integer$iReplace- replace already existed data or not.

◆ addJs()

BxDolTemplate::addJs (   $mixedFiles,
  $bDynamic = false 
)

Add JS file(s) to global output.

Parameters
mixed$mixedFilesstring value represents a single JS file name. An array - array of JS file names.
boolean$bDynamicin the dynamic mode JS file(s) are not included to global output, but are returned from the function directly.
Returns
boolean/string result of operation.

◆ addJsIcon()

BxDolTemplate::addJsIcon (   $aIcons)

Add icon in JS output.

Parameters
array$aIconsan array of icons descriptors. The descriptor is a key/value pear in the array of descriptors.

◆ addJsImage()

BxDolTemplate::addJsImage (   $aImages)

Add image in JS output.

Parameters
array$aImagesan array of image descriptors. The descriptor is a key/value pear in the array of descriptors.

◆ addJsOption()

BxDolTemplate::addJsOption (   $mixedName)

Add Option in JS output.

Parameters
mixed$mixedNameoption's name or an array of options' names.

◆ addJsSystem()

BxDolTemplate::addJsSystem (   $mixedFiles)

Add System JS file(s) to global output. System JS files are the files which are attached to all pages. They will be cached separately from the others.

Parameters
mixed$mixedFilesstring value represents a single JS file name. An array - array of JS file names.
boolean$bDynamicin the dynamic mode JS file(s) are not included to global output, but are returned from the function directly.
Returns
boolean/string result of operation.

◆ addJsTranslation()

BxDolTemplate::addJsTranslation (   $mixedKey,
  $bDynamic = false 
)

Add language translation for key in JS output.

Parameters
mixed$mixedKeylanguage key or an array of keys.

◆ addLocation()

BxDolTemplate::addLocation (   $sKey,
  $sLocationPath,
  $sLocationUrl 
)

Add location in array of locations. Note. Location is the path/url to folder where 'templates' folder is stored.

Parameters
string$sKey- location's unique key.
string$sLocationPath- location's path. For modules: '[path_to_script]/modules/[vendor_name]/[module_name]/'
string$sLocationUrl- location's url. For modules: '[url_to_script]/modules/[vendor_name]/[module_name]/'

◆ addLocationJs()

BxDolTemplate::addLocationJs (   $sKey,
  $sLocationPath,
  $sLocationUrl 
)

Add JS location in array of JS locations. Note. Location is the path/url to folder where JS files are stored.

Parameters
string$sKey- location's unique key.
string$sLocationPath- location's path. For modules: '[path_to_script]/modules/[vendor_name]/[module_name]/js/'
string$sLocationUrl- location's url. For modules: '[url_to_script]/modules/[vendor_name]/[module_name]/js/'

◆ addPageKeywords()

BxDolTemplate::addPageKeywords (   $mixedKeywords,
  $sDevider = ',' 
)

Set page keywords.

Parameters
mixed$mixedKeywordsnecessary page keywords(string - single keyword, array - an array of keywords).
string$sDevider- string devider.

◆ addPageMetaImage()

BxDolTemplate::addPageMetaImage (   $sImageUrl)

Set page meta image.

Parameters
$sImageUrlmeta image url

◆ addPageMetaLocation()

BxDolTemplate::addPageMetaLocation (   $fLat,
  $fLng,
  $sCountryCode 
)

Set page locatoin coordinates.

Parameters
$fLatlatitude
$fLnglongitude

◆ addPageRssLink()

BxDolTemplate::addPageRssLink (   $sTitle,
  $sUrl 
)

Set page rss link.

Parameters
$sTitle- rss feed title
$sUrl- rss feed URL

◆ addRevision()

BxDolTemplate::addRevision (   $sUrl)

Add current revision number to URL.

Returns
string with URL

◆ collectingEndGetCode()

BxDolTemplate::collectingEndGetCode (   $aExcludeCss = array(),
  $aExcludeJs = array(),
  $sFormat = 'html' 
)

Get difference for non-system css and js files from previously remembered state as ready HTML code, additionally filter out css and js from $aExcludeCss and $aExcludeJs arrays

◆ collectingStart()

BxDolTemplate::collectingStart ( )

Remember current state of aPage variable with all css, js, etc

◆ deleteCss()

BxDolTemplate::deleteCss (   $mixedFiles)

Delete CSS file(s) from global output.

Parameters
mixed$mixedFilesstring value represents a single CSS file name. An array - array of CSS file names.
Returns
boolean result of operation.

◆ deleteCssSystem()

BxDolTemplate::deleteCssSystem (   $mixedFiles)

Delete System CSS file(s) from global output.

Parameters
mixed$mixedFilesstring value represents a single CSS file name. An array - array of CSS file names.
Returns
boolean result of operation.

◆ deleteJs()

BxDolTemplate::deleteJs (   $mixedFiles)

Delete JS file(s) from global output.

Parameters
mixed$mixedFilesstring value represents a single JS file name. An array - array of JS file names.
Returns
boolean result of operation.

◆ deleteJsSystem()

BxDolTemplate::deleteJsSystem (   $mixedFiles)

Delete System JS file(s) from global output.

Parameters
mixed$mixedFilesstring value represents a single JS file name. An array - array of JS file names.
Returns
boolean result of operation.

◆ displayAccessDenied()

BxDolTemplate::displayAccessDenied (   $sMsg = '',
  $iPage = BX_PAGE_DEFAULT,
  $iDesignBox = BX_DB_PADDING_DEF 
)

Functions to display pages with errors, messages and so on.

◆ getCached()

BxDolTemplate::getCached (   $sName,
$aVariables,
  $mixedKeyWrapperHtml = null,
  $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH,
  $bEvaluate = true 
)

Get template from cache if it's enabled.

Parameters
string$sNametemplate name
string$aVariableskey/value pairs. key should be the same as template's key, but without prefix and postfix.
mixed$mixedKeyWrapperHtml- key wrapper(string value if left and right parts are the same, array(0 => left, 1 => right) otherwise).
string$sCheckInwhere the content would be searched(base, template, both)
boolean$bEvaluateneed to evaluate the template or not.
Returns
string result of operation or false on failure.

◆ getCode()

BxDolTemplate::getCode ( )

Get currently active template code.

Returns
string template's code.

◆ getCodeKey()

BxDolTemplate::getCodeKey ( )

Get code key.

Returns
string template's code key.

◆ getCss()

BxDolTemplate::getCss ( )

get added css files

◆ getCssClassName()

BxDolTemplate::getCssClassName ( )

Get currently active template name.

Returns
string template's name.

◆ getCssPath()

BxDolTemplate::getCssPath (   $sName,
  $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH 
)

Get full Path of CSS file.

Parameters
string$sName- CSS file name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string full URL.

◆ getCssUrl()

BxDolTemplate::getCssUrl (   $sName,
  $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH 
)

Get full URL of CSS file.

Parameters
string$sName- CSS file name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string full URL.

◆ getEmbed()

BxDolTemplate::getEmbed (   $sContent)

Get embed code.

Returns
string embed's code.

◆ getHtml()

BxDolTemplate::getHtml (   $sName,
  $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH 
)

Get content of HTML file.

Parameters
string$sName- HTML file name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string full content of the file and false on failure.

◆ getIcon()

BxDolTemplate::getIcon (   $mixedId,
  $aParams = array() 
)

Get icon template in dependence of a value, provided in $mixedId.

Parameters
mixed$mixedIdnumeric id from Storage, string with template's file name or string with font icon.

◆ getIconPath()

BxDolTemplate::getIconPath (   $sName,
  $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH 
)

Get absolute Path for the icon.

Parameters
string$sName- icon's file name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string absolute path.

◆ getIconUrl()

BxDolTemplate::getIconUrl (   $sName,
  $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH 
)

Get full URL for the icon.

Parameters
string$sNameicon's file name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string full URL.

◆ getImage()

BxDolTemplate::getImage (   $mixedId,
  $aParams = array() 
)

Get image template in dependence of a value, provided in $mixedId.

Parameters
mixed$mixedIdnumeric id from Storage, string with template's file name or string with font icon.

◆ getImageAuto()

BxDolTemplate::getImageAuto (   $sName,
  $bWrapped = true,
  $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH 
)

Get image/icon by name automatically. Cache item description: [ 'v' => value (name, url or source), 'c' => classes list divided with comma (,) 't' => parse type (ic - icon, im - image, sc - source) ] Cached images can be overwritten by listening 'system' - 'get_layout_images' alert.

Parameters
string$sNameunique name. The following format can be used: name|classes. Where name and classes can consists of multiple parts (divided with comma (,) in HTML variant). For example, in PHP: $this->getImageAuto('far star|class1 class2'); in HTML: <bx_image_auto:far,star|class1,class2 />
boolean$bWrappedwrap in HTML tag or not.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string icon/image value (name, url or source) or final HTML code.

◆ getImageMimeType()

BxDolTemplate::getImageMimeType (   $sExtension)

Get image MIME type.

Parameters
string$sExtension- image file's extension.
Returns
string with MIME type.

◆ getImagePath()

BxDolTemplate::getImagePath (   $sName,
  $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH 
)

Get absolute Path for the image.

Parameters
string$sName- image's file name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string absolute path.

◆ getImageUrl()

BxDolTemplate::getImageUrl (   $sName,
  $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH 
)

Get full URL for the image.

Parameters
string$sName- images's file name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string full URL.

◆ getInstance()

static BxDolTemplate::getInstance ( )
static

Get singleton instance of the class

Implements iBxDolSingleton.

◆ getJs()

BxDolTemplate::getJs ( )

get added js files

◆ getJsPath()

BxDolTemplate::getJsPath (   $sName)

Get full Path of JS file.

Parameters
string$sName- JS file name.
Returns
string full URL.

◆ getJsUrl()

BxDolTemplate::getJsUrl (   $sName)

Get full URL of JS file.

Parameters
string$sName- JS file name.
Returns
string full URL.

◆ getLocations()

BxDolTemplate::getLocations ( )

Get a lis of all added locations.

Returns
array with locations.

◆ getMenu()

BxDolTemplate::getMenu (   $s)

Get menu.

Parameters
$smenu object name
Returns
html or empty string

◆ getMetaInfo()

BxDolTemplate::getMetaInfo ( )

Returns page meta info, like meta keyword, meta description, location, etc

◆ getMix()

BxDolTemplate::getMix ( )

Get currently active template mix.

Returns
integer template's mix.

◆ getName()

BxDolTemplate::getName ( )

Get currently active template name.

Returns
string template's name.

◆ getPageContent()

BxDolTemplate::getPageContent (   $sVar = false,
  $iIndex = false 
)

Get page content for some variable.

Parameters
string$sVarname of content variable
int$iIndexoptional page index, default is index which was set before with
See also
setPageNameIndex function, or 0
Returns
string page content for some variable or for the whole page.

◆ getPageHeader()

BxDolTemplate::getPageHeader ( )

Get page header

Returns
string $s page header

◆ getPageNameIndex()

BxDolTemplate::getPageNameIndex ( )

Get page name index

Returns
int $i name index

◆ getPageParams()

BxDolTemplate::getPageParams ( )

Get page params.

Returns
array $a page params

◆ getPageType()

BxDolTemplate::getPageType ( )

Get page type

Returns
int $i page type

◆ getPath()

BxDolTemplate::getPath ( )

Get currently active template path.

Returns
string template's path.

◆ getRevision()

BxDolTemplate::getRevision ( )

Get current revision number.

Returns
integer number

◆ getTemplate()

BxDolTemplate::getTemplate (   $sName)

Get template, which was loaded earlier.

See also
method this->loadTemplates and field this->_aTemplates
Parameters
string$sName- template name.
Returns
string template's content.

◆ getTemplateFunctions()

BxDolTemplate::getTemplateFunctions ( )

Get template functions object.

See also
BxBaseFunctions

◆ getTemplatePath()

BxDolTemplate::getTemplatePath (   $sName,
  $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH 
)

Get full Path of JS file.

Parameters
string$sName- JS file name.
Returns
string full URL.

◆ getTemplatesCacheObject()

BxDolTemplate::getTemplatesCacheObject ( )

Get cache object for templates

Returns
cache class instance

◆ getTemplateUrl()

BxDolTemplate::getTemplateUrl (   $sName,
  $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH 
)

Get full URL of Template (HTML) file.

Parameters
string$sName- Template file name.
Returns
string full URL.

◆ includeCssAsync()

BxDolTemplate::includeCssAsync ( )

Return script tag with special code to load async css. This tag is added after js files list

◆ includeCssStyles()

BxDolTemplate::includeCssStyles ( )

Include CSS style(s) in the page's head section.

◆ includeFiles()

BxDolTemplate::includeFiles (   $sType,
  $bSystem = false,
  $bWrap = true 
)

Include CSS/JS file(s) attached to the page in its head section.

See also
the method is system and would be called automatically.
Parameters
string$sTypethe type of file('js' or 'css')
Returns
string the result CSS code.

◆ init()

BxDolTemplate::init ( )

Initialize template engine. Note. The method is executed with the system, you shouldn't execute it in your subclasses.

◆ isHtml()

BxDolTemplate::isHtml (   $sName,
  $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH 
)

Check whether HTML file exists or not.

Parameters
string$sName- HTML file name.
string$sCheckInwhere the content would be searched(base, template, both)
Returns
boolean result of operation.

◆ isLocation()

BxDolTemplate::isLocation (   $sKey)

Check whether location exists or not.

Parameters
string$sKey- location's unique key.

◆ isLocationJs()

BxDolTemplate::isLocationJs (   $sKey)

Check whether JS location exists or not.

Parameters
string$sKey- JS location's unique key.

◆ loadTemplates()

BxDolTemplate::loadTemplates ( )

Load templates.

◆ parseButton()

BxDolTemplate::parseButton (   $sContent,
  $aAttrs = array() 
)

Parse tag <BUTTON>

Parameters
string$sContentlink content
array$aAttrsan array of key => value pairs

◆ parseHtmlByContent()

BxDolTemplate::parseHtmlByContent (   $sContent,
  $aVariables,
  $mixedKeyWrapperHtml = null 
)

Parse HTML template.

See also
Doesn't allow to use cache.
Parameters
string$sContent- HTML file content.
array$aVariables- key/value pairs. key should be the same as template's key, but without prefix and postfix.
mixed$mixedKeyWrapperHtml- key wrapper(string value if left and right parts are the same, array(left, right) otherwise).
Returns
string the result of operation.

◆ parseHtmlByName()

BxDolTemplate::parseHtmlByName (   $sName,
  $aVariables,
  $mixedKeyWrapperHtml = null,
  $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH 
)

Parse HTML template. Search for the template with accordance to it's file name.

See also
allows to use cache.
Parameters
string$sName- HTML file name.
array$aVariables- key/value pairs. key should be the same as template's key, but without prefix and postfix.
mixed$mixedKeyWrapperHtml- key wrapper(string value if left and right parts are the same, array(left, right) otherwise).
string$sCheckInwhere the content would be searched(base, template, both)
Returns
string the result of operation.

◆ parseHtmlByTemplateName()

BxDolTemplate::parseHtmlByTemplateName (   $sName,
  $aVariables,
  $mixedKeyWrapperHtml = null 
)

Parse earlier loaded HTML template.

See also
Doesn't allow to use cache.
Parameters
string$sName- template name.
array$aVariables- key/value pairs. Key should be the same as template's key, excluding prefix and postfix.
Returns
string the result of operation.
See also
$this->_aTemplates

◆ parseIcon()

BxDolTemplate::parseIcon (   $sName,
  $aAttrs = array() 
)

Parse font based icon in tag

Parameters
string$sNamefont icon name
array$aAttrsan array of key => value pairs

◆ parseImage()

BxDolTemplate::parseImage (   $sLink,
  $aAttrs = array() 
)

Parse tag

Parameters
string$sLinkURL to image source
array$aAttrsan array of key => value pairs

◆ parseLink()

BxDolTemplate::parseLink (   $sLink,
  $sContent,
  $aAttrs = array() 
)

Parse tag

Parameters
string$sLinklink URL
string$sContentlink content
array$aAttrsan array of key => value pairs

◆ parseLinkByName()

BxDolTemplate::parseLinkByName (   $sName,
  $sLink,
  $sContent,
  $aAttrs = array() 
)

Parse tag using provided HTML template

Parameters
string$sNametemplate's file name
string$sLinklink URL
string$sContentlink content
array$aAttrsan array of key => value pairs

◆ parsePageByName()

BxDolTemplate::parsePageByName (   $sName,
  $aVariables 
)

Parse page HTML template. Search for the page's template with accordance to it's file name.

See also
allows to use cache.
Parameters
string$sName- HTML file name.
array$aVariables- key/value pairs. key should be the same as template's key, but without prefix and postfix.
Returns
string the result of operation.

◆ parseSystemKey()

BxDolTemplate::parseSystemKey (   $sKey,
  $mixedKeyWrapperHtml = null,
  $bProcessInjection = true 
)

Parse system keys.

Parameters
string$sKeykey
Returns
string value associated with the key.

◆ processInjection()

BxDolTemplate::processInjection (   $iPageIndex,
  $sKey,
  $sValue = "" 
)
  • * * Static methods for work with template injections * * *

Static method is used to add/replace the content of some key in the template. It's usefull when you don't want to modify existing template but need to add some data to existing template key.

Parameters
integer$iPageIndex- page index where injections would processed. Use 0 if you want it to be done on all the pages.
string$sKey- template key.
string$sValue- the data to be added.
Returns
string the result of operation.

◆ removeLocation()

BxDolTemplate::removeLocation (   $sKey)

Remove location from array of locations. Note. Location is the path/url to folder where templates are stored.

Parameters
string$sKey- location's unique key.

◆ removeLocationJs()

BxDolTemplate::removeLocationJs (   $sKey)

Remove JS location from array of locations. Note. Location is the path/url to folder where templates are stored.

Parameters
string$sKey- JS location's unique key.

◆ retrieveCode()

static BxDolTemplate::retrieveCode (   $sCodeKey = BX_DOL_TEMPLATE_CODE_KEY,
  $sMixKey = BX_DOL_TEMPLATE_MIX_KEY,
  $sRootPath = BX_DIRECTORY_PATH_ROOT 
)
static

Retrieve template code and check whether it's associated with active template or not.

Parameters
string$sCodeKeytemplate's code key.
string$sMixKeytemplate's mix key.
string$sRootPathpath to root directory.

◆ setPageContent()

BxDolTemplate::setPageContent (   $sVar,
  $sContent,
  $iIndex = false 
)

Set page content for some variable.

Parameters
string$sVarname of content variable
string$sContentcontent for $sVar variable
int$iIndexoptional page index, default is index which was set before with
See also
setPageNameIndex function, or 0

◆ setPageDescription()

BxDolTemplate::setPageDescription (   $sDescription)

Set page description.

Parameters
string$sDescriptionnecessary page description.

◆ setPageHeader()

BxDolTemplate::setPageHeader (   $s)

Set page header

Parameters
string$spage header

◆ setPageInjections()

BxDolTemplate::setPageInjections (   $aInjections)

Set page injections.

Parameters
array$aInjectionsname => value injections.

◆ setPageMainBoxTitle()

BxDolTemplate::setPageMainBoxTitle (   $sTitle)

Set page's main box title.

Deprecated:
use setPageParams
Parameters
string$sTitlenecessary page's main box title.

◆ setPageMetaRobots()

BxDolTemplate::setPageMetaRobots (   $s)

Set page meta robots.

Parameters
string$spage meta robots.

◆ setPageMetaTitle()

BxDolTemplate::setPageMetaTitle (   $sTitle)

Set page meta title.

Parameters
stringsTitle necessary page description.

◆ setPageNameIndex()

BxDolTemplate::setPageNameIndex (   $i)

Set page name index

Parameters
int$iname index

◆ setPageNameIndexByTarget()

BxDolTemplate::setPageNameIndexByTarget (   $s)

Set page name index by target.

Parameters
string$starget.

◆ setPageParams()

BxDolTemplate::setPageParams (   $a)

Set page params. Available page params are: name_index, header

Parameters
array$apage params

◆ setPageTitle()

BxDolTemplate::setPageTitle (   $sTitle)

Set page title.

Deprecated:
use setPageHeader
Parameters
string$sTitlenecessary page title.

◆ setPageType()

BxDolTemplate::setPageType (   $i)

Set page type

Parameters
int$ipage type

◆ setPageUrl()

BxDolTemplate::setPageUrl (   $s)

Set page url

Parameters
string$spage url

Member Data Documentation

◆ $_bCacheEnable

BxDolTemplate::$_bCacheEnable
protected

Cache related fields

◆ $_sName

BxDolTemplate::$_sName
protected

Main fields


The documentation for this class was generated from the following file: