smartyAutoload
smarty_php_tag
DS
SMARTY_DIR
SMARTY_MBSTRING
SMARTY_PLUGINS_DIR
SMARTY_RESOURCE_CHAR_SET
SMARTY_RESOURCE_DATE_FORMAT
SMARTY_SPL_AUTOLOAD
SMARTY_SYSPLUGINS_DIR
smartyAutoload($class)
smarty_php_tag(array $params, string $content, object $template, boolean $repeat) : string
arrayparameter list
stringcontents of the block
objecttemplate object
boolean&$repeat repeat flag
stringcontent re-formattedDS
SMARTY_DIR
SMARTY_MBSTRING
SMARTY_PLUGINS_DIR
SMARTY_RESOURCE_CHAR_SET
SMARTY_RESOURCE_DATE_FORMAT
SMARTY_SPL_AUTOLOAD
SMARTY_SYSPLUGINS_DIR
Smarty Internal Plugin Compile Block Plugin Class
« More »Smarty Internal Plugin Compile Function Plugin Class
« More »Smarty Internal Plugin Compile Object Block Function Class
« More »Smarty Internal Plugin Compile Object Function Class
« More »Smarty Internal Plugin Compile Print Expression Class
« More »Smarty Internal Plugin Compile Registered Block Class
« More »Smarty Internal Plugin Compile Registered Function Class
« More »Smarty Internal Plugin Compile special Smarty Variable Class
« More »smarty_modifier_debug_print_var(array | object $var, integer $depth, integer $length) : string
Type: modifier
Name: debug_print_var
Purpose: formats variable contents for display in the console
| author | Monte Ohrt <monte at ohrt dot com> |
|---|
arrayobjectvariable to be formatted
integermaximum recursion depth if $var is an array
integermaximum string length if $var is a string
stringsmarty_block_php($params, string $content, object $template, $repeat) : string
stringcontents of the block
objecttemplate object
stringcontent re-formattedsmarty_block_textformat(array $params, string $content, \Smarty_Internal_Template $template, boolean $repeat) : string
Type: block function
Name: textformat
Purpose: format text a certain way with preset styles
or custom wrap/indent settings
Params:
- style - string (email)
- indent - integer (0)
- wrap - integer (80)
- wrap_char - string ("\n")
- indent_char - string (" ")
- wrap_boundary - boolean (true)
| link | {textformat} (Smarty online manual) |
|---|---|
| author | Monte Ohrt <monte at ohrt dot com> |
arrayparameters
stringcontents of the block
boolean&$repeat repeat flag
stringcontent re-formattedsmarty_outputfilter_trimwhitespace(string $source, \Smarty_Internal_Template $smarty) : string
Trim unnecessary whitespace from HTML markup.
| author | Rodney Rehm |
|---|---|
| todo | substr_replace() is not overloaded by mbstring.func_overload - so this function might fail! |
stringinput string
stringfiltered outputsmarty_variablefilter_htmlspecialchars(string $source, \Smarty_Internal_Template $smarty) : string
stringinput string
stringfiltered outputsmarty_function_counter(array $params, \Smarty_Internal_Template $template) : string | null
Type: function
Name: counter
Purpose: print out a counter value
| author | Monte Ohrt <monte at ohrt dot com> |
|---|---|
| link | {counter} (Smarty online manual) |
arrayparameters
stringnull
smarty_function_cycle(array $params, \Smarty_Internal_Template $template) : string | null
Type: function
Name: cycle
Date: May 3, 2002
Purpose: cycle through given values
Params:
- name - name of cycle (optional)
- values - comma separated list of values to cycle, or an array of values to cycle
(this can be left out for subsequent calls)
- reset - boolean - resets given var to true
- print - boolean - print var or not. default is true
- advance - boolean - whether or not to advance the cycle
- delimiter - the value delimiter, default is ","
- assign - boolean, assigns to template var instead of printed.
Examples:
{cycle values="#eeeeee,#d0d0d0d"}
{cycle name=row values="one,two,three" reset=true}
{cycle name=row}
| link | {cycle} (Smarty online manual) |
|---|---|
| author | Monte Ohrt <monte at ohrt dot com> |
| author | credit to Mark Priatel |
| author | credit to Gerard |
| author | credit to Jason Sweat |
| version | 1.3 |
arrayparameters
stringnull
smarty_function_fetch(array $params, \Smarty_Internal_Template $template) : string | null
Type: function
Name: fetch
Purpose: fetch file, web or ftp data and display results
| link | {fetch} (Smarty online manual) |
|---|---|
| author | Monte Ohrt <monte at ohrt dot com> |
arrayparameters
stringnullif the assign parameter is passed, Smarty assigns the result to a template variablesmarty_function_html_checkboxes(array $params, object $template) : string
File: function.html_checkboxes.php
Type: function
Name: html_checkboxes
Date: 24.Feb.2003
Purpose: Prints out a list of checkbox input types
Examples:
{html_checkboxes values=$ids output=$names}
{html_checkboxes values=$ids name='box' separator='
' output=$names}
{html_checkboxes values=$ids checked=$checked separator='
' output=$names}
Params:
- name (optional) - string default "checkbox" - values (required) - array - options (optional) - associative array - checked (optional) - array default not set - separator (optional) - ie
or - output (optional) - the output next to each checkbox - assign (optional) - assign the output as an array to this variable - escape (optional) - escape the content (not value), defaults to true
| link | {html_checkboxes} (Smarty online manual) |
|---|---|
| author | Christopher Kvarme |
| author | credits to Monte Ohrt <monte at ohrt dot com> |
| version | 1.0 |
| uses | \global\smarty_function_escape_special_chars() |
arrayparameters
objecttemplate object
stringsmarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape)
smarty_function_html_image(array $params, \Smarty_Internal_Template $template) : string
Type: function
Name: html_image
Date: Feb 24, 2003
Purpose: format HTML tags for the image
Examples: {html_image file="/images/masthead.gif"}
Output: ![]()
Params:
- file - (required) - file (and path) of image - height - (optional) - image height (default actual height) - width - (optional) - image width (default actual width) - basedir - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT - path_prefix - prefix for path output (optional, default empty)
| link | {html_image} (Smarty online manual) |
|---|---|
| author | Monte Ohrt <monte at ohrt dot com> |
| author | credits to Duda |
| version | 1.0 |
| uses | \global\smarty_function_escape_special_chars() |
arrayparameters
stringsmarty_function_html_radios(array $params, \Smarty_Internal_Template $template) : string
File: function.html_radios.php
Type: function
Name: html_radios
Date: 24.Feb.2003
Purpose: Prints out a list of radio input types
Params:
- name (optional) - string default "radio" - values (required) - array - options (required) - associative array - checked (optional) - array default not set - separator (optional) - ie
or - output (optional) - the output next to each radio button - assign (optional) - assign the output as an array to this variable - escape (optional) - escape the content (not value), defaults to true
Examples:
{html_radios values=$ids output=$names}
{html_radios values=$ids name='box' separator='
' output=$names}
{html_radios values=$ids checked=$checked separator='
' output=$names}
| link | {html_radios} (Smarty online manual) |
|---|---|
| author | Christopher Kvarme |
| author | credits to Monte Ohrt <monte at ohrt dot com> |
| version | 1.0 |
| uses | \global\smarty_function_escape_special_chars() |
arrayparameters
stringsmarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape)
smarty_function_html_select_date(array $params, \Smarty_Internal_Template $template) : string
Type: function
Name: html_select_date
Purpose: Prints the dropdowns for date selection.
ChangeLog:
- 1.0 initial release
- 1.1 added support for +/- N syntax for begin
and end year values. (Monte)
- 1.2 added support for yyyy-mm-dd syntax for
time value. (Jan Rosier)
- 1.3 added support for choosing format for
month values (Gary Loescher)
- 1.3.1 added support for choosing format for
day values (Marcus Bointon)
- 1.3.2 support negative timestamps, force year
dropdown to include given date unless explicitly set (Monte)
- 1.3.4 fix behaviour of 0000-00-00 00:00:00 dates to match that
of 0000-00-00 dates (cybot, boots)
- 2.0 complete rewrite for performance,
added attributes month_names, *_id
| link | {html_select_date} (Smarty online manual) |
|---|---|
| version | 2.0 |
| author | Andrei Zmievski |
| author | Monte Ohrt <monte at ohrt dot com> |
| author | Rodney Rehm |
arrayparameters
stringsmarty_function_html_select_time(array $params, \Smarty_Internal_Template $template) : string
Type: function
Name: html_select_time
Purpose: Prints the dropdowns for time selection
| link | {html_select_time} (Smarty online manual) |
|---|---|
| author | Roberto Berto |
| author | Monte Ohrt <monte AT ohrt DOT com> |
| uses | \global\smarty_make_timestamp() |
arrayparameters
stringsmarty_function_html_table(array $params, \Smarty_Internal_Template $template) : string
Type: function
Name: html_table
Date: Feb 17, 2003
Purpose: make an html table from an array of data
Params:
- loop - array to loop through
- cols - number of columns, comma separated list of column names
or array of column names
- rows - number of rows
- table_attr - table attributes
- th_attr - table heading attributes (arrays are cycled)
- tr_attr - table row attributes (arrays are cycled)
- td_attr - table cell attributes (arrays are cycled)
- trailpad - value to pad trailing cells with
- caption - text for caption element
- vdir - vertical direction (default: "down", means top-to-bottom)
- hdir - horizontal direction (default: "right", means left-to-right)
- inner - inner loop (default "cols": print $loop line by line,
$loop will be printed column by column otherwise)
Examples:
{table loop=$data}
{table loop=$data cols=4 tr_attr='"bgcolor=red"'}
{table loop=$data cols="first,second,third" tr_attr=$colors}
arrayparameters
stringsmarty_function_html_table_cycle($name, $var, $no)
smarty_function_mailto(array $params, \Smarty_Internal_Template $template) : string
Type: function
Name: mailto
Date: May 21, 2002
Purpose: automate mailto address link creation, and optionally encode them.
Params:
- address - (required) - e-mail address
- text - (optional) - text to display, default is address
- encode - (optional) - can be one of:
* none : no encoding (default)
* javascript : encode with javascript
* javascript_charcode : encode with javascript charcode
* hex : encode with hexidecimal (no javascript)
- cc - (optional) - address(es) to carbon copy
- bcc - (optional) - address(es) to blind carbon copy
- subject - (optional) - e-mail subject
- newsgroups - (optional) - newsgroup(s) to post to
- followupto - (optional) - address(es) to follow up to
- extra - (optional) - extra tags for the href link
Examples:
{mailto address="me@domain.com"}
{mailto address="me@domain.com" encode="javascript"}
{mailto address="me@domain.com" encode="hex"}
{mailto address="me@domain.com" subject="Hello to you!"}
{mailto address="me@domain.com" cc="you@domain.com,they@domain.com"}
{mailto address="me@domain.com" extra='class="mailto"'}
| link | {mailto} (Smarty online manual) |
|---|---|
| version | 1.2 |
| author | Monte Ohrt <monte at ohrt dot com> |
| author | credits to Jason Sweat (added cc, bcc and subject functionality) |
arrayparameters
stringsmarty_function_math(array $params, \Smarty_Internal_Template $template) : string | null
Type: function
Name: math
Purpose: handle math computations in template
| link | {math} (Smarty online manual) |
|---|---|
| author | Monte Ohrt <monte at ohrt dot com> |
arrayparameters
stringnull
This class does call function defined with the {function} tag
« More »smarty_modifier_capitalize(string $string, boolean $uc_digits, boolean $lc_rest) : string
Type: modifier
Name: capitalize
Purpose: capitalize words in the string
| author | Monte Ohrt <monte at ohrt dot com> |
|---|---|
| author | Rodney Rehm |
stringstring to capitalize
booleanalso capitalize "x123" to "X123"
booleancapitalize first letters, lowercase all following letters "aAa" to "Aaa"
stringcapitalized stringsmarty_modifier_date_format(string $string, string $format, string $default_date, string $formatter) : string
Type: modifier
Name: date_format
Purpose: format datestamps via strftime
Input:
- string: input date string
- format: strftime format for output
- default_date: default date if $string is empty
| link | date_format (Smarty online manual) |
|---|---|
| author | Monte Ohrt <monte at ohrt dot com> |
| uses | \global\smarty_make_timestamp() |
stringinput date string
stringstrftime format for output
stringdefault date if $string is empty
stringeither 'strftime' or 'auto'
string|voidsmarty_modifier_escape(string $string, string $esc_type, string $char_set, boolean $double_encode) : string
Type: modifier
Name: escape
Purpose: escape string for output
| link | count_characters (Smarty online manual) |
|---|---|
| author | Monte Ohrt <monte at ohrt dot com> |
stringinput string
stringescape type
stringcharacter set, used for htmlspecialchars() or htmlentities()
booleanencode already encoded entitites again, used for htmlspecialchars() or htmlentities()
stringescaped input stringsmarty_modifier_regex_replace(string $string, string | array $search, string | array $replace) : string
Type: modifier
Name: regex_replace
Purpose: regular expression search/replace
| link | regex_replace (Smarty online manual) |
|---|---|
| author | Monte Ohrt <monte at ohrt dot com> |
stringinput string
stringarrayregular expression(s) to search for
stringarraystring(s) that should be replaced
stringsmarty_modifier_replace(string $string, string $search, string $replace) : string
Type: modifier
Name: replace
Purpose: simple search/replace
| link | replace (Smarty online manual) |
|---|---|
| author | Monte Ohrt <monte at ohrt dot com> |
| author | Uwe Tews |
stringinput string
stringtext to search for
stringreplacement text
stringsmarty_modifier_spacify(string $string, string $spacify_char) : string
Type: modifier
Name: spacify
Purpose: add spaces between characters in a string
| link | spacify (Smarty online manual) |
|---|---|
| author | Monte Ohrt <monte at ohrt dot com> |
stringinput string
stringstring to insert between characters.
stringsmarty_modifier_truncate(string $string, integer $length, string $etc, boolean $break_words, boolean $middle) : string
Type: modifier
Name: truncate
Purpose: Truncate a string to a certain length if necessary,
optionally splitting in the middle of a word, and
appending the $etc string or inserting $etc into the middle.
| link | truncate (Smarty online manual) |
|---|---|
| author | Monte Ohrt <monte at ohrt dot com> |
stringinput string
integerlength of truncated text
stringend string
booleantruncate at word boundary
booleantruncate in the middle of text
stringtruncated stringsmarty_modifiercompiler_cat(array $params, $compiler) : string
Type: modifier
Name: cat
Date: Feb 24, 2003
Purpose: catenate a value to a variable
Input: string to catenate
Example: {$var|cat:"foo"}
| link | cat (Smarty online manual) |
|---|---|
| author | Uwe Tews |
arrayparameters
stringwith compiled codesmarty_modifiercompiler_count_characters(array $params, $compiler) : string
Type: modifier
Name: count_characteres
Purpose: count the number of characters in a text
| link | count_characters (Smarty online manual) |
|---|---|
| author | Uwe Tews |
arrayparameters
stringwith compiled codesmarty_modifiercompiler_count_paragraphs(array $params, $compiler) : string
Type: modifier
Name: count_paragraphs
Purpose: count the number of paragraphs in a text
| link | count_paragraphs (Smarty online manual) |
|---|---|
| author | Uwe Tews |
arrayparameters
stringwith compiled codesmarty_modifiercompiler_count_sentences(array $params, $compiler) : string
Type: modifier
Name: count_sentences
Purpose: count the number of sentences in a text
| link | count_sentences (Smarty online manual) |
|---|---|
| author | Uwe Tews |
arrayparameters
stringwith compiled codesmarty_modifiercompiler_count_words(array $params, $compiler) : string
Type: modifier
Name: count_words
Purpose: count the number of words in a text
| link | count_words (Smarty online manual) |
|---|---|
| author | Uwe Tews |
arrayparameters
stringwith compiled codesmarty_modifiercompiler_default(array $params, $compiler) : string
Type: modifier
Name: default
Purpose: designate default value for empty variables
| link | default (Smarty online manual) |
|---|---|
| author | Uwe Tews |
arrayparameters
stringwith compiled codesmarty_modifiercompiler_escape(array $params, $compiler) : string
Type: modifier
Name: escape
Purpose: escape string for output
| link | count_characters (Smarty online manual) |
|---|---|
| author | Rodney Rehm |
arrayparameters
stringwith compiled codesmarty_modifiercompiler_from_charset(array $params, $compiler) : string
Type: modifier
Name: from_charset
Purpose: convert character encoding from $charset to internal encoding
| author | Rodney Rehm |
|---|
arrayparameters
stringwith compiled codesmarty_modifiercompiler_indent(array $params, $compiler) : string
Type: modifier
Name: indent
Purpose: indent lines of text
| link | indent (Smarty online manual) |
|---|---|
| author | Uwe Tews |
arrayparameters
stringwith compiled codesmarty_modifiercompiler_lower(array $params, $compiler) : string
Type: modifier
Name: lower
Purpose: convert string to lowercase
| link | lower (Smarty online manual) |
|---|---|
| author | Monte Ohrt <monte at ohrt dot com> |
| author | Uwe Tews |
arrayparameters
stringwith compiled codesmarty_modifiercompiler_string_format(array $params, $compiler) : string
Type: modifier
Name: string_format
Purpose: format strings via sprintf
| link | string_format (Smarty online manual) |
|---|---|
| author | Uwe Tews |
arrayparameters
stringwith compiled codesmarty_modifiercompiler_strip(array $params, $compiler) : string
Type: modifier
Name: strip
Purpose: Replace all repeated spaces, newlines, tabs
with a single space or supplied replacement string.
Example: {$var|strip} {$var|strip:" "}
Date: September 25th, 2002
| link | strip (Smarty online manual) |
|---|---|
| author | Uwe Tews |
arrayparameters
stringwith compiled codesmarty_modifiercompiler_to_charset(array $params, $compiler) : string
Type: modifier
Name: to_charset
Purpose: convert character encoding from internal encoding to $charset
| author | Rodney Rehm |
|---|
arrayparameters
stringwith compiled codesmarty_modifiercompiler_unescape(array $params, $compiler) : string
Type: modifier
Name: unescape
Purpose: unescape html entities
| author | Rodney Rehm |
|---|
arrayparameters
stringwith compiled codesmarty_modifiercompiler_upper(array $params, $compiler) : string
Type: modifier
Name: lower
Purpose: convert string to uppercase
| link | lower (Smarty online manual) |
|---|---|
| author | Uwe Tews |
arrayparameters
stringwith compiled codesmarty_modifiercompiler_wordwrap(array $params, $compiler) : string
Type: modifier
Name: wordwrap
Purpose: wrap a string of text at a given length
| link | wordwrap (Smarty online manual) |
|---|---|
| author | Uwe Tews |
arrayparameters
stringwith compiled codesmarty_function_escape_special_chars(string $string) : string
Function: smarty_function_escape_special_chars
Purpose: used by other smarty functions to escape
special chars except for already escaped ones
| author | Monte Ohrt <monte at ohrt dot com> |
|---|
stringtext that should by escaped
stringsmarty_function_escape_special_chars(string $string) : string
Function: smarty_function_escape_special_chars
Purpose: used by other smarty functions to escape
special chars except for already escaped ones
| author | Monte Ohrt <monte at ohrt dot com> |
|---|
stringtext that should by escaped
stringsmarty_literal_compiler_param(array $params, integer $index, mixed $default) : mixed
| author | Rodney Rehm |
|---|
arrayparameter array as given to the compiler function
integerarray index of the parameter to convert
mixedvalue to be returned if the parameter is not present
\SmartyException |
if parameter is not a literal (but an expression, variable, …) |
|---|
mixedevaluated value of parameter or $defaultsmarty_mb_from_unicode(integer | array $unicode, string $encoding) : string
| link | for inspiration |
|---|---|
| author | Rodney Rehm |
integerarraysingle unicode or list of unicodes to convert
stringencoding of returned string, if null mb_internal_encoding() is used
stringunicode as character sequence in given $encodingsmarty_mb_str_replace(string $search, string $replace, string $subject, int $count) : string
| author | Rodney Rehm |
|---|
stringthe string to be searched
stringthe replacement string
stringthe source string
int&$count number of matches found
stringreplaced stringsmarty_mb_to_unicode(string $string, string $encoding) : array
| link | for inspiration |
|---|---|
| author | Rodney Rehm |
stringcharacters to calculate unicode of
stringencoding of $string, if null mb_internal_encoding() is used
arraysequence of unicodessmarty_mb_wordwrap(string $str, int $width, string $break, boolean $cut) : string
| link | for similarity |
|---|---|
| author | Rodney Rehm |
stringthe string to wrap
intthe width of the output
stringthe character used to break the line
booleanignored parameter, just for the sake of
stringwrapped string