PHP Class Backend\Core\Engine\TemplateModifiers

Author: Tijs Verkoyen ([email protected])
Mostra file Open project: forkcms/forkcms Class Usage Examples

Public Methods

Method Description
count ( array $data ) : integer Returns the count of the count of the array.
formatDate ( integer $var ) : string Format a UNIX-timestamp as a date syntax: {{ $var|formatdate }}
formatDateTime ( integer $var ) : string Format a UNIX-timestamp as a date syntax: {{ $var|formatdatetime }}
formatFloat ( float $number, integer $decimals = 2 ) : string Format a number as a float syntax: {$var|formatfloat}
formatNumber ( float $number, integer $decimals = null ) : string Format a number syntax: {{ $string|formatnumber($decimals) }}
formatTime ( integer $var ) : string Format a UNIX-timestamp as a date syntax: {{ $var|formatdate }}
getURL ( string $action = null, string $module = null, string $suffix = null, string $language = null ) : string Convert a var into a URL syntax: {{ geturl:[:] }}
toLabel ( string $value ) : string Convert this string into a well formed label.
truncate ( string $var = null, integer $length, boolean $useHellip = true, boolean $closestWord = false ) : string Truncate a string syntax: {$var|truncate:max-length[:append-hellip][:closest-word]}

Method Details

count() public static method

Returns the count of the count of the array.
public static count ( array $data ) : integer
$data array
return integer

formatDate() public static method

Format a UNIX-timestamp as a date syntax: {{ $var|formatdate }}
public static formatDate ( integer $var ) : string
$var integer The UNIX-timestamp to format.
return string

formatDateTime() public static method

Format a UNIX-timestamp as a date syntax: {{ $var|formatdatetime }}
public static formatDateTime ( integer $var ) : string
$var integer The UNIX-timestamp to format.
return string

formatFloat() public static method

Format a number as a float syntax: {$var|formatfloat}
public static formatFloat ( float $number, integer $decimals = 2 ) : string
$number float The number to format.
$decimals integer The number of decimals.
return string

formatNumber() public static method

Format a number syntax: {{ $string|formatnumber($decimals) }}
public static formatNumber ( float $number, integer $decimals = null ) : string
$number float The number to format.
$decimals integer The number of decimals
return string

formatTime() public static method

Format a UNIX-timestamp as a date syntax: {{ $var|formatdate }}
public static formatTime ( integer $var ) : string
$var integer The UNIX-timestamp to format.
return string

getURL() public static method

Convert a var into a URL syntax: {{ geturl:[:] }}
public static getURL ( string $action = null, string $module = null, string $suffix = null, string $language = null ) : string
$action string The action to build the URL for.
$module string The module to build the URL for.
$suffix string A string to append.
$language string A language code
return string

toLabel() public static method

syntax: {{ var|tolabel }}.
public static toLabel ( string $value ) : string
$value string The value to convert to a label.
return string

truncate() public static method

Truncate a string syntax: {$var|truncate:max-length[:append-hellip][:closest-word]}
public static truncate ( string $var = null, integer $length, boolean $useHellip = true, boolean $closestWord = false ) : string
$var string The string passed from the template.
$length integer The maximum length of the truncated string.
$useHellip boolean Should a hellip be appended if the length exceeds the requested length?
$closestWord boolean Truncate on exact length or on closest word?
return string