Go to the source code of this file.
|
| twig_cycle ($values, $position) |
| Cycles over a value. More...
|
|
| twig_random (Twig_Environment $env, $values=null) |
| Returns a random value depending on the supplied parameter type: More...
|
|
| twig_date_format_filter (Twig_Environment $env, $date, $format=null, $timezone=null) |
| Converts a date to the given format. More...
|
|
| twig_date_modify_filter (Twig_Environment $env, $date, $modifier) |
| Returns a new date object modified. More...
|
|
| twig_date_converter (Twig_Environment $env, $date=null, $timezone=null) |
| Converts an input to a DateTime instance. More...
|
|
| twig_number_format_filter (Twig_Environment $env, $number, $decimal=null, $decimalPoint=null, $thousandSep=null) |
| Number format filter. More...
|
|
| twig_urlencode_filter ($url, $raw=false) |
| URL encodes a string as a path segment or an array as a query string. More...
|
|
twig_cycle |
( |
|
$values, |
|
|
|
$position |
|
) |
| |
Cycles over a value.
- Parameters
-
ArrayAccess | array | $values | An array or an ArrayAccess instance |
integer | $position | The cycle position |
- Returns
- string The next value in the cycle
Definition at line 319 of file Core.php.
Converts an input to a DateTime instance.
{% if date(user.created_at) < date('+2days') %}
{# do something #}
{% endif %}
- Parameters
-
- Returns
- DateTime A DateTime instance
Definition at line 451 of file Core.php.
twig_date_format_filter |
( |
Twig_Environment |
$env, |
|
|
|
$date, |
|
|
|
$format = null , |
|
|
|
$timezone = null |
|
) |
| |
Converts a date to the given format.
{{ post.published_at|date("m/d/Y") }}
- Parameters
-
- Returns
- string The formatted date
Definition at line 401 of file Core.php.
Returns a new date object modified.
{{ post.published_at|date_modify("-1day")|date("m/d/Y") }}
- Parameters
-
- Returns
- DateTime A new date object
Definition at line 428 of file Core.php.
twig_number_format_filter |
( |
Twig_Environment |
$env, |
|
|
|
$number, |
|
|
|
$decimal = null , |
|
|
|
$decimalPoint = null , |
|
|
|
$thousandSep = null |
|
) |
| |
Number format filter.
All of the formatting options can be left null, in that case the defaults will be used. Supplying any of the parameters will override the defaults set in the environment object.
- Parameters
-
Twig_Environment | $env | A Twig_Environment instance |
mixed | $number | A float/int/string of the number to format |
integer | $decimal | The number of decimal points to display. |
string | $decimalPoint | The character(s) to use for the decimal point. |
string | $thousandSep | The character(s) to use for the thousands separator. |
- Returns
- string The formatted number
Definition at line 499 of file Core.php.
Returns a random value depending on the supplied parameter type:
- a random item from a Traversable or array
- a random character from a string
- a random integer between 0 and the integer parameter
- Parameters
-
- Exceptions
-
Twig_Error_Runtime | When $values is an empty array (does not apply to an empty string which is returned as is). |
- Returns
- mixed A random value from the given sequence
Definition at line 341 of file Core.php.
twig_urlencode_filter |
( |
|
$url, |
|
|
|
$raw = false |
|
) |
| |
URL encodes a string as a path segment or an array as a query string.
- Parameters
-
string | array | $url | A URL or an array of query parameters |
bool | $raw | true to use rawurlencode() instead of urlencode |
- Returns
- string The URL encoded value
JSON encodes a variable.
- Parameters
-
mixed | $value | The value to encode. |
integer | $options | Not used on PHP 5.2.x |
- Returns
- mixed The JSON encoded value
Definition at line 525 of file Core.php.