Smarty Plugin Repository

NOTICE: this repository is no longer kept up-to-date. Please use the wiki for plugin contributions.
(Windows IE users right-click the download link and "save target as...")
compiler.lang.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * File:     compiler.lang.php
 * Type:     compiler function
 * Name:     lang
 * Version:  1.0
 * Date:     August 12, 2002
 * Purpose:  Transform the {lang} tags into intermediate tags
 *           to be read by postfilter.lang
 *          
 *
 * Example:  {lang Select}
 *    Will replace the tag with the translated string for "Select",
 *    taken from a translation string definition file.
 *        
 * Install:  Just drop into the plugin directory.
 *          
 * Author:   Alejandro Sarco <ale@sarco.com.ar>
 * -------------------------------------------------------------
 */
function.ahref.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     function
 * Name:     ahref
 * Purpose:  if url is present make link out of a string otherwise simply disply the string
 *			extra features: prefix, postfix if the string is not empty, nice way to decrease the number of 'if' expressions
 * Version:  1.0
 * Date:     September 25, 2002
 * Purpose:  Parses the intermediate tags left by compiler.lang
 *           and replaces them with the translated strings,
 *           according to the $compile_id value (language code).
 *          
 * Install:  Drop into the plugin directory
 * Author:   Peter Dudas <duda at bigfish dot hu>
 * -------------------------------------------------------------
 *		CHANGES: 	2002.09.25		- created
 *
 */
function.assign_array.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     function
 * Name:     assign_array
 * Version:  1.0
 * Author:   Jens Lehmann <jenslehmann@goldmail.de>
 * Credits:  Monte Ohrt <monte@ispi.net>
 * Purpose:  assign an array to a template variable
 * Input:    var       =  name of the array
 *           values    =  list of values (seperated by delimiter)
 *           delimiter =  value delimiter, default is ","
 *
 * Examples: {assign_array var="foo" values="bar1,bar2"}
 *           {assign_array var="foo" values="bar1;bar2;bar3" delimiter=";"}
 * -------------------------------------------------------------
 */
function.html_list.php view download
/*
* Smarty plugin
* -------------------------------------------------------------
* Type:     function
* Name:     html_list
* Version:     0.1
* Date:     2003-03-06
* Author:     Joscha Feth, joscha@feth.com, www.feth.com
* Purpose:  Prints a list (either an ordered list  or an unordered list)
* Params:   
*             needed        array    values    the values for the list, array can cotain other arrays
*          optional    string    list    either "ol" or "ul" default is "ul"
*            optional    string    type    for ordered lists:        I,i,A or a
*                                        for unordered lists:    circle, square or disc
*             optional    string    xl_attr    additional attributes for the "ol" or "ul" tags
*             optional    string    li_attr    additional attributes for the "li" tags
* Usage:    {html_list values=$array} - creates an unordered list
*             {html_list values=$array list="ol"} - creates an ordered list
*             {html_list values=$array type="square"} - creates an unordered list with squares
* Install: Drop into the plugin directory
*                            
* -------------------------------------------------------------
*/
function.html_select_state.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     function
 * Name:     html_select_state
 * Version:  1.0
 * Purpose:  Prints the dropdowns for states selection.
 * Author:   Matthieu Le goff <tubbix@free.fr>
 *
 * ChangeLog: 1.0 initial release
 * -------------------------------------------------------------
 */
function.html_select_timezone.html view  
function.html_select_timezone.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     function
 * Name:     html_select_timezone
 * Purpose:  Prints the dropdowns for timezone offset selection
 * -------------------------------------------------------------
 * Copyright (c) 2002, Alan McFarlane <amcfarlane@bigfoot.com>
 * All Rights Reserved.
 * -------------------------------------------------------------
 * Revision History:
 *
 *	2002-03-13 - 1.03.00 [AM]
 *		Added support for the 'return' attribute (see docs)
 *
 *	2002-03-12 - 1.02.00 [AM]
 *		Added support for the 'function' attribute (see docs)
 *
 *	2002-03-11 - 1.01.00 [AM]
 *		Added support for full HTML DTD
 *
 *	2002-03-10 - 1.00.00 [AM]
 *		Initial Revision
 *
 */
function.image.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     function
 * Name:     image
 * Version:  1.0
 * Date:     Novemeber 2, 2002
 * Purpose:	displays an image tag according to the settings, 
 *			features: size limits (width, height), underscript, link
 *       
 * Install:  Drop into the plugin directory
 * Author:   Peter Dudas <duda at bigfish dot hu>
 * -------------------------------------------------------------
 *		CHANGES: 	2002.09.25		- created
 *		CHANGES: 	2003.01.13		- bugfixes, new optional parameters
 *
 */
function.linked_heading.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     function
 * Name:     linked_heading
 * Version:  1.0
 * Author:   Ben Finney <bignose@zip.com.au>
 * Purpose:  Generate a hyperlinked header element
 * Input:    level  = heading level (1..6)
 *           id     = id name (target of anchor tag)
 *           text   = heading text
 * Example:  {linked_heading level=2 id="about" text="About us"}
 * -------------------------------------------------------------
 */
function.mailto.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     function
 * Name:     mailto
 * Version:  1.2
 * Date:     May 21, 2002
 * Author:	 Monte Ohrt <monte@ispi.net>
 * Credits:  Jason Sweat (added cc, bcc and subject functionality)
 * Purpose:  automate mailto address link creation, and optionally
 *           encode them.
 * Input:    address = 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
 *                 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
 * 
 * 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"}
 * -------------------------------------------------------------
 */
function.pager.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     function
 * Name:     pager
 * Purpose:  create a paging output to be able to browse long lists 
 * Version:  1.0
 * Date:     September 29, 2002
 * Install:  Drop into the plugin directory
 * Author:   Peter Dudas <duda at bigfish dot hu>
 * -------------------------------------------------------------
 *
 * example:
 * <{pager rowcount=$LISTDATA.rowcount limit=$LISTDATA.limit txt_first=$L_MORE class_num="fl" class_numon="fl" class_text="fl"}>
 *
 *	CHANGES:		2003.03.14:	positionable prev/next string. can use image instead of text
 *	CHANGES:		2003.03.21:	Bugfix
 *
 *
 */
function.pagerabc.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     function
 * Name:     pagerabc
 * Purpose:  displays selection links (eg: filter according the abc)
 * Version:  1.0
 * Date:     September 25, 2002
 * Purpose:  print out
 * Install:  Drop into the plugin directory
 * Author:   Peter Dudas <duda at bigfish dot hu>
 * -------------------------------------------------------------
 *		CHANGES: 	2002.09.25		- created
 *
 *	example:
 *	code:
 *	<{pagerabc posvar="abc" class_num="dl" class_numon="header" separator="
 *  &nbsp;-&nbsp " names="A,B;C,D;E,F;G,H;I,J;K,L;M,N,O;P,Q,R;S,T;U,V,W,X,Y,Z"}>
 *	
 *  result
 *
 *  <a class="header" href="/egyuttes.php?&abc=A,B">A,B</a>
 *  &nbsp;-&nbsp <a class="dl" href="/egyuttes.php?&abc=C,D">C,D</a>
 *  &nbsp;-&nbsp <a class="dl" href="/egyuttes.php?&abc=E,F">E,F</a>
 *  &nbsp;-&nbsp <a class="dl" href="/egyuttes.php?&abc=G,H">G,H</a>
 *  &nbsp;-&nbsp <a class="dl" href="/egyuttes.php?&abc=I,J">I,J</a>
 *  &nbsp;-&nbsp <a class="dl" href="/egyuttes.php?&abc=K,L">K,L</a>
 *  &nbsp;-&nbsp <a class="dl" href="/egyuttes.php?&abc=M,N,O">M,N,O</a>
 *  &nbsp;-&nbsp <a class="dl" href="/egyuttes.php?&abc=P,Q,R">P,Q,R</a>
 *  &nbsp;-&nbsp <a class="dl" href="/egyuttes.php?&abc=S,T">S,T</a>
 *  &nbsp;-&nbsp <a class="dl" href="/egyuttes.php?&abc=U,V,W,X,Y,Z">U,V,W,X,Y,Z</a></p>
 *
 *
 */
insert.dyna_session.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     insert
 * Name:     dyna_session
 * Purpose:  return session_name and id, dependent on session
 *           cookies. supports a leading string. returns an
 *           an empty string, if cookie could be set.
 * Examples:
 *
 * Append only session to a link, if necessary:
 *   <a href="file.php{insert name=dyna_session lead_by=?}">link</a>
 *
 * Append session to a link with params, if necessary: 
 *   <a href="file.php?a=1&amp;b=2{insert name=dyna_session lead_by=&amp;}">link</a>
 *
 * Author: Norbert Röcher <norbert.roecher@t-online.de>
 * -------------------------------------------------------------
 */
insert.session_id.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     function
 * Name:     session_id
 * Purpose:  print out a session id
 * Example: (for sid = session_name())
 *
 *   <a href="file.php?sid={insert name=session_id}">link</a>
 *
 * You can also use: 
 *
 *   <a href="file.php?sid={$smarty.request.sid}">link</a>
 *
 * but in this case value of sid will be cached.
 *
 * Author:   Jaroslaw Zabiello <webmaster@watchtower.org.pl>
 * -------------------------------------------------------------
 */
modifier.fsize_format.php view download
/*
* Smarty plugin
* -------------------------------------------------------------
* Type:    modifier
* Name:    fsize_format
* Version:    0.1
* Date:    2003-02-21
* Author:    Joscha Feth, joscha@feth.com
* Purpose: formats a filesize (in bytes) to human-readable format
* Usage:    In the template, use
            {$filesize|fsize_format}    =>    123.45 B|KB|MB|GB|TB
            or
            {$filesize|fsize_format:"MB"}    =>    123.45 MB
            or
            {$filesize|fsize_format:"TB":4}    =>    0.0012 TB
* Params:    
            int        size        the filesize in bytes
            string    format        the format, the output shall be: B, KB, MB, GB or TB
            int        precision    the rounding precision    
* Install: Drop into the plugin directory
* -------------------------------------------------------------
*/
modifier.math.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Name:     math
 * Version:  0.1
 * Date:     2002-04-15
 * File:     modifier.math.php
 * Type:     modifier
 * Purpose:  Simple math modifier, replaces 'x' in an equation
 *           with the template variable and calculates the result.
 * Examples: {$numbervar|math:"x * 10"}
 *           {$numbervar|math:"abs(x)"}
 *           {$arrayvar|@count|math:"x * 2"}
 * Install:  Drop into the plugin directory.
 * Author:   Linus McCabe, Linus@McCabe.nu, http://anticapslock.com
 * -------------------------------------------------------------
 */
modifier.money_format.php view download
/*
 * Smarty plugin
 *
-------------------------------------------------------------
 * File:     modifier.money_format.php
 * Type:     modifier
 * Name:     money_format
 * Version:  1.0
 * Date:     Feb 8th, 2003
 * Purpose:  pass value to PHP money_format() and return result
 * Install:  Drop into the plugin directory.
 * Author:   Michael L. Fladischer <mfladischer@abis.co.at>
 *
-------------------------------------------------------------
 */
modifier.number_format.php view download
/*
 * Smarty plugin
 *
-------------------------------------------------------------
 * File:     modifier.number_format.php
 * Type:     modifier
 * Name:     number_format
 * Version:  1.0
 * Date:     May 1st, 2002
 * Purpose:  pass value to PHP number_format() and return result
 * Install:  Drop into the plugin directory.
 * Author:   Jason E. Sweat <jsweat_php@yahoo.com>
 *
-------------------------------------------------------------
 */
modifier.numbertext.php view download
/*
 * Smarty plugin
 * --------------------------------------------------------------------------
 * File:     modifier.numbertext.php
 * Type:     modifier
 * Name:     numbertext
 * Version:  1.01
 * Date:     April 21, 2002
 * Purpose:  Outputs alternative text to numeric variables.
 *           Example:
 *           {$number_of_records|numbertext:"no records":"one record":"%d records"}
 *           If $number_of_records==0 it outputs 'no records'
 *           If $number_of_records==1 it outputs 'one record'
 *           If $number_of_records==34 it outputs '34 records'
 * Install:  Drop into the plugin directory.
 * Author:   Andreas Heintze <andreas.heintze@home.se>
 * --------------------------------------------------------------------------
 */
modifier.slice.html view  
modifier.slice.php view download
/*
 * Smarty plugin
 * --------------------------------------------------------------------------
 * File:     modifier.slice.php
 * Type:     modifier
 * Name:     slice
 * Version:  1.0
 * Date:     March 14th, 2002
 * Purpose:  Chops the middle out of a long string.
 *           Example:
 *           {$url|slice:20}
 *           If $url == 'http://www.phpinsider.com/' it outputs
 *             'http://ww...der.com/'
 * Install:  Drop into the plugin directory.
 * Author:   Benjamin Curtis <ben_curtis@hotmail.com>
 * --------------------------------------------------------------------------
 */
modifier.trim.php view download
/*
 * Smarty plugin
 *
-------------------------------------------------------------
 * File:     modifier.trim.php
 * Type:     modifier
 * Name:     trim
 * Version:  1.0
 * Date:     May 1st, 2002
 * Purpose:  pass value to PHP trim() and return result
 * Install:  Drop into the plugin directory.
 * Author:   Jason E. Sweat <jsweat_php@yahoo.com>
 *
-------------------------------------------------------------
 */
outputfilter.trimwhitespace.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * File:     outputfilter.trimwhitespace.php
 * Type:     outputfilter
 * Name:     trimwhitespace
 * Version:  1.2
 * Date:     April 30, 2002
 * Purpose:  trim leading white space and blank lines from
 *           template source after it gets interpreted, cleaning
 *           up code and saving bandwidth. Does not affect
 *           <PRE></PRE> and <SCRIPT></SCRIPT> blocks.
 * Install:  Drop into the plugin directory, call 
 *           $smarty->load_filter('output','trimwhitespace');
 *           from application.
 * Author:   Monte Ohrt <monte@ispi.net>
 * -------------------------------------------------------------
 */
postfilter.lang.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * File:     postfilter.lang.php
 * Type:     postfilter
 * Name:     lang
 * Version:  1.0
 * Date:     August 12, 2002
 * Purpose:  Parses the intermediate tags left by compiler.lang
 *           and replaces them with the translated strings,
 *           according to the $compile_id value (language code).
 *          
 * Install:  Drop into the plugin directory, call
 *           $smarty->load_filter('post','lang');
 *            or
 *           $smarty->autoload_filters = array('post' => array('lang'));
 *           from application.
 * Author:   Alejandro Sarco <ale@sarco.com.ar>
 * -------------------------------------------------------------
 */
postfilter.lang.txt view  
prefilter.showinfoheader.php view download
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * File:     prefilter.showinfoheader.php
 * Type:     prefilter
 * Name:     showinfoheader
 * Version:  1.0
 * Date:     March 14th, 2002
 * Purpose:  Add a header stating smarty version
 *           and current date.
 * Install:  Drop into the plugin directory,
 *           call load_filter('prefilter','showinfoheader');
 *           from your application.
 * Author:   Monte Ohrt <monte@ispi.net>
 * -------------------------------------------------------------
 */