Class TemplateHelpers (namespace Nette\Templates)


Standard template helpers shipped with Nette Framework.


Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /Templates/Filters/TemplateHelpers.php (line 30)
Public Method Summary
TemplateHelpers
Static class - cannot be instantiated.
static string
bytes (int $bytes)
Converts to human readable file size.
static string
date (string|int|DateTime $value, [string $format = "%x"])
Date/time formatting.
static string
escapeCss (string $s)
Escapes string for use inside CSS template.
static string
escapeHtml (mixed $s)
Escapes string for use inside HTML template.
static string
escapeHtmlCss (string $s)
Escapes string for use inside HTML style attribute.
static string
escapeHtmlJs (mixed $s)
Escapes string for use inside HTML JavaScript attribute.
static string
escapeJs (mixed $s)
Escapes string for use inside JavaScript template.
static string
escapeXML (string $s)
Escapes string for use inside XML 1.0 template.
static string
indent (string $s, [int $level = 1], [string $chars = "\t"])
Indents the HTML content from the left.
static callback
loader (string $helper)
Try to load the requested helper.
static string
strip (string $s)
Replaces all repeated white spaces with a single space.

Method Details

line 36

__construct

public TemplateHelpers __construct ()

Static class - cannot be instantiated.

Output
TemplateHelpers  

line 202

bytes

public static string bytes (int $bytes)

Converts to human readable file size.

Input
int $bytes
Output
string  

line 189

date

public static string date (string|int|DateTime $value, [string $format = "%x"])

Date/time formatting.

Input
string|int|DateTime $value
string $format
Output
string  

line 98

escapeCss

public static string escapeCss (string $s)

Escapes string for use inside CSS template.

Input
string $s UTF-8 encoding or 8-bit
Output
string  

line 69

escapeHtml

public static string escapeHtml (mixed $s)

Escapes string for use inside HTML template.

Input
mixed $s UTF-8 encoding or 8-bit
Output
string  

line 111

escapeHtmlCss

public static string escapeHtmlCss (string $s)

Escapes string for use inside HTML style attribute.

Input
string $s UTF-8 encoding or 8-bit
Output
string  

line 135

escapeHtmlJs

public static string escapeHtmlJs (mixed $s)

Escapes string for use inside HTML JavaScript attribute.

Input
mixed $s UTF-8 encoding
Output
string  

line 123

escapeJs

public static string escapeJs (mixed $s)

Escapes string for use inside JavaScript template.

Input
mixed $s UTF-8 encoding
Output
string  

line 84

escapeXML

public static string escapeXML (string $s)

Escapes string for use inside XML 1.0 template.

Input
string $s UTF-8 encoding or 8-bit
Output
string  

line 161

indent

public static string indent (string $s, [int $level = 1], [string $chars = "\t"])

Indents the HTML content from the left.

Input
string $s UTF-8 encoding or 8-bit
int $level
string $chars
Output
string  

line 48

loader

public static callback loader (string $helper)

Try to load the requested helper.

Input
string $helper helper name
Output
callback  

line 147

strip

public static string strip (string $s)

Replaces all repeated white spaces with a single space.

Input
string $s UTF-8 encoding or 8-bit
Output
string