Functions

Smarty {counter} function plugin

smarty_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)

Parameters

$params

array

parameters

$template

\Smarty_Internal_Template

template object

Returns

stringnull

Smarty {cycle} function plugin

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

Parameters

$params

array

parameters

$template

\Smarty_Internal_Template

template object

Returns

stringnull

Smarty {fetch} plugin

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>

Parameters

$params

array

parameters

$template

\Smarty_Internal_Template

template object

Returns

stringnullif the assign parameter is passed, Smarty assigns the result to a template variable

Smarty {html_checkboxes} function plugin

smarty_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()

Parameters

$params

array

parameters

$template

object

template object

Returns

string

smarty_function_html_checkboxes_output()

smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape) 

Parameters

$name

$value

$output

$selected

$extra

$separator

$labels

$label_ids

$escape

Smarty {html_image} function plugin

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()

Parameters

$params

array

parameters

$template

\Smarty_Internal_Template

template object

Returns

string

Smarty {html_options} function plugin

smarty_function_html_options(array $params, \Smarty_Internal_Template $template) : string

Type: function
Name: html_options
Purpose: Prints the list of

- name       (optional) - string default "select"
- values     (required) - if no options supplied) - array
- options    (required) - if no values supplied) - associative array
- selected   (optional) - string default not set
- output     (required) - if not options supplied) - array
- id         (optional) - string default not set
- class      (optional) - string default not set
link {html_image} (Smarty online manual)
author Monte Ohrt <monte at ohrt dot com>
author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de>
uses \global\smarty_function_escape_special_chars()

Parameters

$params

array

parameters

$template

\Smarty_Internal_Template

template object

Returns

string

smarty_function_html_options_optgroup()

smarty_function_html_options_optgroup($key, $values, $selected, $id, $class, $idx) 

Parameters

$key

$values

$selected

$id

$class

$idx

smarty_function_html_options_optoutput()

smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, $idx) 

Parameters

$key

$value

$selected

$id

$class

$idx

Smarty {html_radios} function plugin

smarty_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()

Parameters

$params

array

parameters

$template

\Smarty_Internal_Template

template object

Returns

string

smarty_function_html_radios_output()

smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape) 

Parameters

$name

$value

$output

$selected

$extra

$separator

$labels

$label_ids

$escape

Smarty {html_select_date} plugin

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

Parameters

$params

array

parameters

$template

\Smarty_Internal_Template

template object

Returns

string

Smarty {html_select_time} function plugin

smarty_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()

Parameters

$params

array

parameters

$template

\Smarty_Internal_Template

template object

Returns

string

Smarty {html_table} function plugin

smarty_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}
author Monte Ohrt <monte at ohrt dot com>
author credit to Messju Mohr <messju at lammfellpuschen dot de>
author credit to boots <boots dot smarty at yahoo dot com>
version 1.1
link {html_table} (Smarty online manual)

Parameters

$params

array

parameters

$template

\Smarty_Internal_Template

template object

Returns

string

smarty_function_html_table_cycle()

smarty_function_html_table_cycle($name, $var, $no) 

Parameters

$name

$var

$no

Smarty {mailto} function plugin

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)

Parameters

$params

array

parameters

$template

\Smarty_Internal_Template

template object

Returns

string

Smarty {math} function plugin

smarty_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>

Parameters

$params

array

parameters

$template

\Smarty_Internal_Template

template object

Returns

stringnull