Amiro.CMS API Reference
Amiro.Ru / Manual
Loading search...

The AMI_TemplateSystem class

• Introduction

System template parser class.

• Class synopsis

AMI_TemplateSystem implements AMI_iTemplate {
/* Methods */
// Constructor.
public __construct ( ) returns AMI_TemplateSystem;
// Adds block.
public addBlock ( string $name, string $path, [ bool $override = FALSE ] ) returns void;
// Adds JavaScript inclusion.
public addScript ( string $path, [ bool $useAsync = FALSE ], [ bool $isFullPath = FALSE ] ) returns void;
// Adds JavaScript code to the page.
public addScriptCode ( string $code ) returns void;
// Drops block.
public dropBlock ( string $name ) returns void;
// Returns block locale.
public getBlockLocale ( string $name ) returns array;
// Returns array of available variables in set.
public getSetScope ( ) returns array;
// Returns true if block set is set.
public issetSet ( string $name ) returns bool;
// Merges block to the existing block.
public mergeBlock ( string $name, string $path ) returns void;
// Parses block set.
public parse ( string $name, [ $aScope = array() ] ) returns string;
// Parses locale and return array having locale names as keys and its values as values.
public parseLocale ( string $path, [ string $locale = 'auto' ], [ bool $override = FALSE ] ) returns array;
// Parses string.
public parseString ( string $string, [ $aScope = array() ] ) returns string;
// Sets block locale from array.
public setBlockLocale ( string $name, $aLocale, [ bool $doAppend = FALSE ] ) returns void;
// Sets current template locale.
public setLocale ( string $locale ) returns void;
// Sets source for templates or language files for location. Mask and subdirectories are not supported.
public setLocationSource ( string $location, [ string $mode = 'auto' ] ) returns void;
// Sets current set variable.
public setScopeVar ( string $name, [ string $value = '' ] ) returns void;
}

• Class Methods

// Constructor.
public __construct ( ) returns AMI_TemplateSystem;
// Adds block.
public addBlock ( string $name, string $path, [ bool $override = FALSE ] ) returns void;
  • string $name
    Internal block name
  • string $path
    Template path
  • bool $override
    Flag specifying to override existing loaded block

Implementation of: AMI_iTemplate::addBlock().

// Adds JavaScript inclusion.
public addScript ( string $path, [ bool $useAsync = FALSE ], [ bool $isFullPath = FALSE ] ) returns void;
  • string $path
    Path to the javascript file
  • bool $useAsync
    Use async script inclusion if TRUE
  • bool $isFullPath
    The path is full if TRUE
Tags:
since 5.14.4
// Adds JavaScript code to the page.
public addScriptCode ( string $code ) returns void;
  • string $code
    JavaScript code
Tags:
since 5.14.8
// Drops block.
public dropBlock ( string $name ) returns void;
  • string $name
    Internal block name

Implementation of: AMI_iTemplate::dropBlock().

// Returns block locale.
public getBlockLocale ( string $name ) returns array;
  • string $name
    Block name

Implementation of: AMI_iTemplate::getBlockLocale().

Tags:
since 5.14.0
// Returns array of available variables in set.
public getSetScope ( ) returns array;
Tags:
since 5.12.8
// Returns true if block set is set.
public issetSet ( string $name ) returns bool;
  • string $name
    Set name in format "{$blockName}:{$setName}"

Implementation of: AMI_iTemplate::issetSet().

// Merges block to the existing block.
public mergeBlock ( string $name, string $path ) returns void;
  • string $name
    Internal block name
  • string $path
    Template path

Implementation of: AMI_iTemplate::mergeBlock().

Tags:
since 5.12.4
// Parses block set.
public parse ( string $name, [ $aScope = array() ] ) returns string;
  • string $name
    Set name in format "{$blockName}:{$setName}"
  • array $aScope
    Scope

Implementation of: AMI_iTemplate::parse().

// Parses locale and return array having locale names as keys and its values as values.
public parseLocale ( string $path, [ string $locale = 'auto' ], [ bool $override = FALSE ] ) returns array;
  • string $path
    Locale path
  • string $locale
    Locale for data in locale file, use 'auto' for current locale
  • bool $override
    Flag specifying to override existing loaded locale

Implementation of: AMI_iTemplate::parseLocale().

// Parses string.
public parseString ( string $string, [ $aScope = array() ] ) returns string;
  • string $string
    String to parse
  • array $aScope
    Scope

Implementation of: AMI_iTemplate::parseString().

// Sets block locale from array.
public setBlockLocale ( string $name, $aLocale, [ bool $doAppend = FALSE ] ) returns void;
  • string $name
    Block name
  • array $aLocale
    Array of locale data as language_variable => translation
  • bool $doAppend
    Append locale to existing one

Implementation of: AMI_iTemplate::setBlockLocale().

// Sets current template locale.
public setLocale ( string $locale ) returns void;
  • string $locale
    New locale name

Implementation of: AMI_iTemplate::setLocale().

// Sets source for templates or language files for location. Mask and subdirectories are not supported.
public setLocationSource ( string $location, [ string $mode = 'auto' ] ) returns void;
  • string $location
    Path to template files
  • string $mode
    Template location: 'fs' | 'db' | 'auto'
  Example:
// Sets current set variable.
public setScopeVar ( string $name, [ string $value = '' ] ) returns void;
  • string $name
    Variable name
  • string $value
    Variable value
Tags:
since 5.12.8