
Funzioni smarty e MdLite

Con l'introduzione del motore grafico Autorender, che va a soppiantare il suo predecessore autotheme, questo Cms si e' ammodernizzato verso la tecnologia smarty.
Cos' è Smarty ?
Smarty è un motore di web template scritto in PHP. Smarty consente di separare il codice PHP, il business logic (la programmazione del software), dal codice HTML, il presentation logic (l'aspetto grafico di un sito web), e di generare contenuti web mediante il rimpiazzo di speciali Smarty tag all'interno del documento (sostituzione di variabili e molto altro).
Un tag (marcatore) è una direttiva, racchiusa da speciali caratteri (tipicamente parentesi graffe), interpretata dal motore di Smarty. Queste direttive possono essere delle variabili, denotate dal simbolo del dollaro ($), funzioni, o anche istruzioni di controllo del flusso. Smarty permette ai programmatori PHP di definire delle funzioni da includere nei tag stessi di Smarty. (Tratto da wikipedia)
Quali sono le funzioni disponibili e come funzionano ?
Seguendo il percorso \libs\render_smarty\plugins\ , prendendo come riferimento la root della vostra installazione di mdpro, troverete le funzioni smarty. Ora le descriveremo una ad una prendendo in esame i file stessi tenendo presente che in questa cartella troveremo sia le api ( Application Programming Interface ) che le funzioni smarty.

Le Application Programming Interface API (Interfaccia di Programmazione di un'Applicazione), sono ogni insieme di procedure disponibili al programmatore, di solito raggruppate a formare un set di strumenti specifici per un determinato compito. È un metodo per ottenere un'astrazione, di solito tra l'hardware e il programmatore, o tra software a basso ed alto livello. Le API permettono di evitare ai programmatori di scrivere tutte le funzioni dal nulla. Le API stesse sono un'astrazione: il software che fornisce una certa API è detto implementazione dell'API. (wikipedia)
Autorender plugin to return the html code for closetable()
Available parameters:
- - none
Example
<% closetable %>
Autorender plugin to prepare variable for display, preserving some HTML tags
This modifier carries out suitable escaping of characters such that when output
as part of an HTML page the exact string is displayed, except for a number of
admin-defined HTML tags which are left as-is for display purposes.
This modifier should be used with great care, as it does allow certain
HTML tags to be displayed.
The HTML tags that will be displayed are those defined in the configuration
variable AllowableHTML , which is set on a per-instance basis by the site administrator.
Running this modifier multiple times is cumulative and is not reversible.
It recommended that variables that have been returned from this modifier
are only used to display the results, and then discarded.
Example
<% $MyVar|pnvarprephtmldisplay %>
Autorender plugin to prepare variable for database storage
This modifier carries out suitable escaping of characters such that when
inserted into a database the exact string is stored.
Example
<% $MyVar|pnvarprepforstore %>
Autorender plugin to prepare a variable for display
This modifier carries out suitable escaping of characters such that when
output as part of an HTML page the exact string is displayed.
Running this modifier multiple times is cumulative and is not reversible.
It recommended that variables that have been returned from this modifier
are only used to display the results, and then discarded.
Example
<% $MyVar|pnvarprepfordisplay %>
Autorender plugin to remove censored words
This modifier examines the contents of the passed variable for words which
are deemed offensive or otherwise not allowed to be displayed. These words
are replaced with asterix marks to show that words have been removed.
This modifier tries to be intelligent in its attempt to remove censored
words whilst not censoring words on the censor list that happen to be
embedded in a larger word.
This modifier uses the information provided in the configuration setting
'reservedstring' as the basis of the words that it censors. It also looks for
commonly derivations of the words used to try to avoid censoring. The system
is also case-insensitive.
Care should be taken to consider the effect of censorship, and if it should
be applied to all information that is passed in by the user or if it should
only be used in specific cases.
This modifier is to be removed in future versions, as pnVarCensor is being moved
to be a transform hook.
Example
<% $MyVar|pnvarcensor %>
Autorender plugin to apply transform hooks
This modifier will run the transform hooks that are enabled for the
corresponding module (like Autolinks, bbclick and others).
Available parameters:
- - modname: The well-known name of the calling module; passed to the hook function
in the extrainfo array
Example
<% $MyVar|pnmodcallhooks %>
Autorender plugin to format datestamps via strftime according to locale setting in MAXdev
Autorender plugin to prepare a variable for display
by converting special characters to HTML entities
Example
<% $MyVar|htmlspecialchars %>
Autorender display plugin to return a tooltip help icon
Available parameters:
- - name: Required parameter, set this to the language variable for the tooltip content
Example
<% tooltip name="_languagevar" %>
Autorender plugin to get the MAXdev version number
available parameters:
- - assign if set, the language will be assigned to this variable
Examples
<% pnversion %>
<% pnversion assign="version" %>.... <% $version %>
Autorender plugin to obtain form variable
this plugin obtains the variable from the input namespace. It removes any preparsing
done by PHP to ensure that the string is exactly as expected, without any escaped characters.
it also removes any HTML tags that could be considered dangerous to the MAXdev system's security.
Available parameters:
- - name: the name of the parameter
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Autorender plugin to get a user variable
This function obtains a user-specific variable from the MAXdev system.
Note that the results should be handled by the pnvarprepfordisplay of the
pnvarprephtmldisplay modifiers before being displayed.
Available parameters:
- - name: The name of the variable being requested
- - uid: The user id to obtain the variable for - this parameter is optional
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Example
<% pnusergetvar name="user_icq" uid=1|pnvarprepfordisplay %>
Autorender plugin to get the current users theme
Available parameters:
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Examples
<% pnusergettheme %>
<% pnusergettheme assign="theme" %>....<% $theme %>
Autorender plugin to get the users language
This function determines the recent users language
Available parameters:
- - assign: If set, the result is assigned to the corresponding variable instead of printed out
Examples
<% pnusergetlang %>
<% pnusergetlang assign="lang" %>.... <% $lang %>
Autorender plugin to get a colour definition from the theme
This function returns the corresponding color define from the theme
Available parameters:
- - name: Name of the colour definition
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Examples
<% pnthemegetvar name="bgcolor2" %>
<% pnthemegetvar name="bgcolor2" assign="background" %>....<% $background %>
Autorender plugin to set a session variable
This function sets a session-specific variable in the MAXdev system.
Note that the results should be handled by the pnvarprepfordisplay or the
pnvarprephtmldisplay modifiers before being displayed.
Available parameters:
- - name: The name of the session variable to obtain
- - value: The value for the session variable
Example
<% pnsessionsetvar name="foo" value="bar" %>
Autorender plugin to get a session variable
This function obtains a session-specific variable from the MAXdev system.
Note that the results should be handled by the pnvarprepfordisplay or the
pnvarprephtmldisplay modifiers before being displayed.
Available parameters:
- - name: The name of the session variable to obtain
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Example
<% pnsessiongetvar name="foobar"|pnvarprepfordisplay %>
Autorender plugin to delete a session variable
This function deletes a session-specific variable from the system.
Available parameters:
- - name: The name of the session variable to delete
- - assign: If set, the result is assigned to the corresponding variable instead of printed out
Example
<% pnsessiondelvar name="foobar" %>
Autorender plugin to generate a unique key to secure forms content as unique.
As the MGD states, all operations protected by pnSecAuthAction(). Ih the form,
you generate a hidden field with the authid in your form, and check the authid
in the submission. T.this way you can be sure that the data was given in your
form (and not given by any POST/GET data from outside)
Available parameters:
- - module: The well-known name of a module to execute a function from (required)
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Example
<input type="hidden" name="authid" value="<% pnsecgenauthkey module="MyModule" %>">
Autorender plugin to check permissions
Example:
<% pnsecauthaction comp="Stories::" inst=".*" level="ACCESS_ADMIN" assign="auth" %>
true/false will be returned.
Autorender plugin to create a MAXdev-compatible URL for a specific module function.
This function returns a module URL string if successful. Unlike the API
function pnModURL, this is already sanitized to display, so it should not be
passed to the pnvarprepfordisplay modifier.
Available parameters:
- - modname: The well-known name of a module for which to create the URL (required)
- - type: The type of function for which to create the URL; currently one of 'user' or 'admin' (default is 'user')
- - func: The actual module function for which to create the URL (default is 'main')
- - ssl: See below
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
- - all remaining parameters are passed to the module function
Example
Create a URL to the News 'view' function with parameters 'sid' set to 3 and 'index' set to '0'
<a href="<% pnmodurl modname="News" type="user" func="view" sid="3" index="0" %>">Link</a>
Example SSL
Create a secure https:// URL to the News 'view' function with parameters 'sid' set to 3 and 'index' set to '0' ssl - set to constant null,true,false NOTE: $ssl = true not $ssl = 'true' null - leave the current status untouched, true - create a ssl url, false - create a non-ssl url
<a href="<% pnmodurl modname="News" type="user" func="view" sid="3" index="0" ssl=true %>">Link</a>
Autorender plugin to check for the availability of a module
This function calls pnModIsHooked to determine if two MAXdev modules are
hooked together. True is returned if the modules are hooked, false otherwise.
The result can also be assigned to a template variable.
Available parameters:
- - tmodname: The well-known name of the hook module
- - smodname: The well-known name of the calling module
- - assign: The name of a variable to which the results are assigned
Examples
<% pnmodishooked tmodname="Ratings" smodname="News" %>
<% pnmodishooked tmodname="bar" smodname="foo" assign=barishookedtofoo %>
<% if $barishookedtofoo %>.....<% /if %>
Autorender plugin to get all module variables
This function obtains all the variables for a specified module
Note that the results should be handled by the pnvarprepfordisplay of the
pnvarprephtmldisplay modifiers before being displayed.
Available parameters:
- - module: The well-known name of a module from which to obtain the variable
- - name: The name of the module variable to obtain
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Example
<% pnmodgetvars module="Example" %>
Autorender plugin to get a module variable
This function obtains a module-specific variable from the MAXdev system.
Note that the results should be handled by the pnvarprepfordisplay of the
pnvarprephtmldisplay modifiers before being displayed.
Available parameters:
- - module: The well-known name of a module from which to obtain the variable
- - name: The name of the module variable to obtain
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Example
<% pnmodgetvar module="Example" name="foobar" %>
Autorender plugin to the topmost module name
This function currently returns the name of the current top-level
module, false if not in a module.
Available parameters:
- - assign: If set, the results are assigned to the corresponding
variable instead of printed out
Example
<% pnmodgetname|pnvarprepfordisplay %>
Autorender plugin to retrieve module information
This function retrieves module information from the database and returns them
or assigns them to a variable for later use
Available parameters:
- - info the information you want to retrieve from the modules info,"all" results in assigning all information, see $assign
- - assign (optional or mandatory :-)) if set, assign the result instead of returning it if $info is "all", a $assign is mandatory and the default is modinfo
- - modname (optional) module name, if not set, the recent module is used
Example
<% pnmodgetinfo info=displayname %>
<% pnmodgetinfo info=all assign=gimmeeverything %>
<% pnmodgetinfo modname=mymodname info=all assign=gimmeeverything %>
Autorender plugin to to execute a module function
This function calls a specific module function. It returns whatever the return
value of the resultant function is if it succeeds.
Note that in contrast to the API function pnModFunc you need not to load the
module with pnModLoad.
Available parameters:
- - modname: The well-known name of a module to execute a function from (required)
- - type: The type of function to execute; currently one of 'user' or 'admin' (default is 'user')
- - func: The name of the module function to execute (default is 'main')
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
- - all remaining parameters are passed to the module function
Example
<% pnmodfunc modname="News" type="user" func="display" %>
Autorender plugin call hooks
This function calls a specific module function. It returns whatever the return
value of the resultant function is if it succeeds.
Note that in contrast to the API function pnmodcallhooks you need not to load the
module with pnModLoad.
Available parameters:
- - 'hookobject' the object the hook is called for - either 'item' or 'category'
- - 'hookaction' the action the hook is called for - one of 'create', 'delete', 'transform', or 'display'
- - 'hookid' the id of the object the hook is called for (module-specific)
- - 'assign' If set, the results are assigned to the corresponding variable instead of printed out
- - all remaining parameters are passed to the pnModCallHooks API via the extrainfo array
Example
<% pnmodcallhooks hookobject="item" hookaction="modify" hookid=$tid $modname="Example" $objectid=$tid %>
Autorender plugin to check for the availability of a module
This function calls pnModAvailable to determine if a module is
is available. True is returned if the module is available, false otherwise.
The result can also be assigned to a template variable.
Available parameters:
- - modname: The well-known name of a module to execute a function from (required)
- - assign: The name of a variable to which the results are assigned
Examples
<% pnmodavailable modname="News" %>
<% pnmodapifunc modname="foobar" assign="myfoo" %>
<% if $myfoo %>.....<% /if %>
Autorender plugin to execute a module API function
This function calls a calls a specific module API function. It returns whatever the return
value of the resultant function is if it succeeds.
Note that in contrast to the API function pnModAPIFunc you need not to load the
module API with pnModAPILoad.
Available parameters:
- - modname: The well-known name of a module to execute a function from (required)
- - type: The type of function to execute; currently one of 'user' or 'admin' (default is 'user')
- - func: The name of the module function to execute (default is 'main')
- - assign: The name of a variable to which the results are assigned
- - all remaining parameters are passed to the module API function
Examples
<% pnmodfunc modname="News" type="user" func="getarticles" id="3" %>
<% pnmodapifunc modname="foobar" type="user" func="getfoo" id="1" assign="myfoo" %>
<% myfoo.title %>
pnRender plugin
This file is a plugin for pnRender, the PostNuke implementation of Smarty
@package Xanthia_Templating_Environment
@subpackage pnRender
@version $Id: function.pnimg.php,v 1.4 2007/05/16 21:40:56 timax Exp $
@author The PostNuke development team
@link http://www.postnuke.com The PostNuke Home Page
@copyright Copyright (C) 2002 by the PostNuke Development Team
@license http://www.gnu.org/copyleft/gpl.html GNU General Public License
Smarty function to provide easy access to an image
This function provides an easy way to include an image. The function will return the
full source path to the image. It will as well provite the width and height attributes
if none are set.
Available parameters:
- - src: The file name of the image
- - modname: The well-known name of a module (default: the current module)
- - width, height: If set, they will be passed. If none is set, they are obtained from the image
- - alt: If not set, an empty string is being assigned
- - altml: If true then alt string is assumed to be a ML constant
- - title: If not set, an empty string is being assigned
- - titleml: If true then title string is assumed to be a ML constant
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
- - optional If set then the plugin will not return an error if an image is not found
- - default If set then a default image is used should the requested image not be found (Note: full path required)
- - all remaining parameters are passed to the image tag
Example:
<!--[pnimg src="heading.gif" ]-->
Output:
<img src="modules/Example/images/eng/heading.gif" alt="" width="261" height="69" />
Example:
<!--[pnimg src="heading.gif" width="100" border="1" alt="foobar" ]-->
Output:
<img src="modules/Example/images/eng/heading.gif" width="100" border="1" alt="foobar" />
If the parameter assign is set, the results are assigned as an array. The components of
this array are the same as the attributes of the img tag; additionally an entry 'imgtag' is
set to the complete image tag.
Example:
<!--[pnimg src="heading.gif" assign="myvar"]-->
<!--[$myvar.src]-->
<!--[$myvar.width]-->
<!--[$myvar.imgtag]-->
Output:
modules/Example/images/eng/heading.gif
261
<img src="modules/Example/images/eng/heading.gif" alt="" width="261" height="69" />
Autorender plugin to obtain status message
This function obtains the last status message posted for this session.
The status message exists in one of two session variables: 'statusmsg' for a
status message, or 'errormsg' for an error message. If both a status and an
error message exists then the error message is returned.
This is is a destructive function - it deletes the two session variables
'statusmsg' and 'erorrmsg' during its operation.
Available parameters:
- - assign: If set, the status message is assigned to the corresponding variable instead of printed out
- - style, class: If set, the status message is being put in a div tag with the respective attributes
- - tag: You can specify if you would like a span or a div tag
Example
<% pngetstatusmsg|pnvarprephtmldisplay %>
<% pngetstatusmsg style="color:red;"|pnvarprephtmldisplay %>
<% pngetstatusmsg class="statusmessage" tag="span"|pnvarprephtmldisplay %>
Autorender plugin to obtain base URL for this site
This function obtains the base URL for the site. The base url is defined as the
full URL for the site minus any file information i.e. everything before the
'index.php' from your start page.
Unlike the API function pngethost, the results of this function are already
sanitized to display, so it should not be passed to the pnvarprepfordisplay modifier.
Available parameters:
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Example
<% pngethost %>
Autorender plugin to obtain base URL for this site
This function obtains the base URL for the site. The base url is defined as the
full URL for the site minus any file information i.e. everything before the
'index.php' from your start page.
Unlike the API function pngetcurrenturi, the results of this function are already
sanitized to display, so it should not be passed to the pnvarprepfordisplay modifier.
Available parameters:
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Example
<% pngetcurrenturi %>
Autorender plugin to obtain base URL for this site
This function obtains the base URL for the site. The base url is defined as the
full URL for the site minus any file information i.e. everything before the
'index.php' from your start page.
Unlike the API function pnGetBaseURL, the results of this function are already
sanitized to display, so it should not be passed to the pnvarprepfordisplay modifier.
Available parameters:
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Example
<% pngetbaseurl %>
Autorender plugin to get configuration variable
This function obtains a configuration variable from the MAXdev system.
Note that the results should be handled by the pnvarprepfordisplay or the
pnvarprephtmldisplay modifier before being displayed.
Available parameters:
- - name: The name of the config variable to obtain
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Examples
Welcome to <% pnconfiggetvar name="sitename" %>
Autorender plugin to show a MAXdev block by blockinfo array or blockid.
This function returns a MAXdev block by blockinfo array or blockid
Available parameters:
- - module
- - blockname
- - block
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Autorender plugin to obtain the a block variable
Note: If the name parameter is not set then the assign parameter must be set since there is an array of block variables available.
Available parameters:
- - bid: the block id
- - name: If set the name of the parameter to get otherwise the entire block array is assigned to the template
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Autorender plugin to display an existing MAXdev block.
The block is choosen by its id.
The block state is ignored, so even deactivated blocks
can be shown.
The block specific parameters can be overwritten,
if they are known.
Available parameters:
- - id id of block to be displayed
- - name title of block to be displayed
- - title Overwrites block title
- - position Overwrites position (l,c,r)
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Example
TBD
Autorender plugin to display a banner
This function takes a identifier and returns a banner from the banners module
Available parameters:
- - id: id of the banner group as defined in the banners module
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
Example
<% pnbannerdisplay id=0 %>
Autorender plugin to create alphabetical pagers
Example:
<% pagerabc posvar="abc" class_num="dl" class_numon="header" separator=" - " 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
<span class="pager">
<a class="header" href="index.php?module=Example&abc=A,B"> A,B
</a> - <a class="dl" href="index.php?module=Example&abc=C,D"> C,D
</a> - <a class="dl" href="index.php?module=Example&abc=E,F"> E,F
</a> - <a class="dl" href="index.php?module=Example&abc=G,H"> G,H
</a> - <a class="dl" href="index.php?module=Example&abc=I,J"> I,J
</a> - <a class="dl" href="index.php?module=Example&abc=K,L"> K,L
</a> - <a class="dl" href="index.php?module=Example&abc=M,N,O"> M,N,O
</a> - <a class="dl" href="index.php?module=Example&abc=P,Q,R"> P,Q,R
</a> - <a class="dl" href="index.php?module=Example&abc=S,T"> S,T
</a> - <a class="dl" href="index.php?module=Example&abc=U,V,W,X,Y,Z"> U,V,W,X,Y,Z
</a></span>
Parameters:
- -string: $posvar - name of the variable that contains the position data, eg "letter"
- -cvs: $forwardvars - comma- semicolon- or space-delimited list of POST and GET variables to forward in the pager links. If unset, all vars are forwarded.
- -cvs: $additionalvars - comma- semicolon- or space-delimited list of additional variable and value pairs to forward in the links. eg "foo=2,bar=4"
- -string: $class_num - class for the pager links (<a> tags)
- -string: $class_numon - class for the active page
- -string: $separator - string to put between the letters, eg "|" makes | A | B | C | D |
- -string: $printempty - print empty sel ('-')
- -string: $lang - language
- -array: $names - values to select from (array or csv)
- -string $skin - use predefined values (hu - hungarian ABC)
Autorender plugin to create numeric pagers
Exemple
<% pager rowcount=$LISTDATA.rowcount limit=$LISTDATA.limit txt_first=$L_MORE class_num="fl" class_numon="fl" class_text="fl" %>
Autorender plugin to return the html code for opentable2()
Available parameters:
- - none
Example
<% opentable2 %>
Autorender plugin to return the html code for opentable()
Available parameters:
- - none
Example
<% opentable %>
Autorender plugin to display a drop down list of languages
Available parameters:
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
- - name: Name for the control
- - selected: Selected value
- - installed: if set only show languages existing in languages folder
Example
<% languagelist name=language selected=eng installed=1 %>
Autorender plugin to provide easy access to an image
This function provides an easy way to include an image. The function will return the
full source path to the image. It will as well provite the width and height attributes
if none are set.
Available parameters:
- - src: The file name of the image
- - modname: The well-known name of a module (default: the current module)
- - width, height: If set, they will be passed. If none is set, they are obtained from the image
- - alt: If not set, an empty string is being assigned
- - altml: If true then alt string is assumed to be a ML constant
- - title: If not set, an empty string is being assigned
- - titleml: If true then title string is assumed to be a ML constant
- - assign: If set, the results are assigned to the corresponding variable instead of printed out
- - optional If set then the plugin will not return an error if an image is not found
- - default If set then a default image is used should the requested image not be found (Note: full path required)
- - all remaining parameters are passed to the image tag
Example:
- <% img src="heading.gif" %>
Output: - <img src="modules/Example/images/eng/heading.gif" alt="" width="261" height="69" />
Example:
- <% img src="heading.gif" width="100" border="1" alt="foobar" %>
Output: - <img src="modules/Example/images/eng/heading.gif" width="100" border="1" alt="foobar" />
If the parameter assign is set, the results are assigned as an array. The components of
this array are the same as the attributes of the img tag; additionally an entry 'imgtag' is
set to the complete image tag.
Example:
<% img src="heading.gif" assign="myvar" %>
<% $myvar.src %>
<% $myvar.width %>
<% $myvar.imgtag %>
Output:
modules/Example/images/eng/heading.gif
261
<img src="modules/Example/images/eng/heading.gif" alt="" width="261" height="69" />
Autorender plugin to return a language variable
Available parameters:
- - name = The input language variable
Examples
- <% const name=_YOUR_LANGUAGE_VARIABLE %>
- <% const name=_MAXUPLOAD sizelimit=$size_variable %>
The second example replaces the string %sizelimit% in the language variable with the contents of $size_variable. Should be useful for long strings with 1-2 variables in it
Lang file example: define('_MAXUPLOAD', 'The file size limit of %sizelimit% is in effect');
Autorender plugin to return the html code for closetable2()
Available parameters:
- - none
Example
<% closetable2 %>
Smarty function to add additional information to <head> </head>
Available parameters:
- header: If set, the value is assigned to the global
$additional_header array. The value can be a single
string or an array of strings.
Example
- <% additional_header header='<title>This is the title</title>' %>
OR
- <% additional_header header=$title %>
Autorender plugin to display the list of allowed html tags
Available parameters:
- assign: If set, the results are assigned to the corresponding variable instead of printed out
Examples
- <% allowedhtml %>
- <% allowedhtml assign="allowed" %>.....<% $allowed %>
Smarty function to display Admin Control Panel and Manual links with icons
htmlpages
<% adminmenulinks start="[" end="]" seperator="|" class="pn-menuitem-title" %>
Autorender display plugin to create link to the modules manual.
Available parameters:
- manual: name of manual file, manual.html if not set
- chapter: an anchor in the manual file to jump to
- newwindow: opens the manual in a new window using javascript, default to on
- width: width of the window if newwindow is set, default 600
- height: height of the window if newwindow is set, default 400
- title: name of the new window if newwindow is set, default is _ADMINMANUAL language define
- class: class for use in the <a> tag
- assign: if set, the results ( array('url', 'link') are assigned to the corresponding variable instead of printed out
Example
- <% adminmanual newwindow=1 width=400 height=300 %>

Descrizione delle funzioni smarty
Smarty block plugin
Smarty tag: {textformat}{/textformat}
- 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)
Smarty compiler function plugin
Smarty tag: {assign}
- Type: compiler function
- Name: assign
- Purpose: assign a value to a template variable
Smarty function plugin
Smarty tag: {assign_debug_info}
- Type: function
- Name: assign_debug_info
- Purpose: assign debug info to the template
Smarty function plugin
Smarty tag: {config_load}
- Type: function
- Name: config_load
- Purpose: load config file vars
Smarty function plugin
Smarty tag: {counter}
- Type: function
- Name: counter
- Purpose: print out a counter value
Smarty {cycle} function plugin
Smarty tag: {cycle}
- Type: function
- Name: cycle
- Date: May 3, 2002
- Purpose: cycle through given values
Input:
- 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}
Smarty {fetch} plugin
Smarty tag: {fetch}
- Type: function
- Name: fetch
- Purpose: fetch file, web or ftp data and display results
Smarty {eval} function plugin
Smarty tag: {eval}
- Type: function
- Name: eval
- Purpose: evaluate a template variable as a template
Smarty {html_image} function plugin
Smarty tag: {html images}
- Type: function
- Name: html_image
- Purpose: format HTML tags for the image
Input:
- file = file (and path) of image (required)
- height = image height (optional, default actual height)
- width = image width (optional, default actual width)
- basedir = base directory for absolute paths, default
is environment variable DOCUMENT_ROOT - path_prefix = prefix for path output (optional, default empty)
Examples: {html_image file="/images/masthead.gif"}
Output: <img src="/images/masthead.gif" width=400 height=23>
Smarty {html_checkboxes} function plugin
Smarty tag: {html_checkboxes}
- Type: function
- Name: html_checkboxes
- Purpose: Prints out a list of checkbox input types
Input:
- name (optional) - string default "checkbox"
- values (required) - array
- options (optional) - associative array
- checked (optional) - array default not set
- separator (optional) - ie <br> or
- output (optional) - the output next to each checkbox
- assign (optional) - assign the output as an array to this variable
Examples:
{html_checkboxes values=$ids output=$names}
{html_checkboxes values=$ids name='box' separator='<br>' output=$names}
{html_checkboxes values=$ids checked=$checked separator='<br>' output=$names}
Smarty {html_radios} function plugin
Smarty tag: {html_radios}
- Type: function
- Name: html_radios
- Purpose: Prints out a list of radio input types
Input:
- name (optional) - string default "radio"
- values (required) - array
- options (optional) - associative array
- checked (optional) - array default not set
- separator (optional) - ie <br> or
- output (optional) - the output next to each radio button
- assign (optional) - assign the output as an array to this variable
Examples:
{html_radios values=$ids output=$names}
{html_radios values=$ids name='box' separator='<br>' output=$names}
{html_radios values=$ids checked=$checked separator='<br>' output=$names}
Smarty {html_options} function plugin
Smarty tag: {html_options}
- Type: function
- Name: html_options
Input:
- 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
Purpose: Prints the list of <option> tags generated from the passed parameters
Smarty {html_select_time} function plugin
Smarty tag: {html_select_time}
- Type: function
- Name: html_select_time
- Purpose: Prints the dropdowns for time selection
Smarty {mailto} function plugin
Smarty tag: {mailto}
- Type: function<br>
- Name: mailto<br>
- Date: May 21, 2002
- 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
- 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"'}
Smarty {popup} function plugin
Smarty tag: {popup}
- type: function
- Name: popup
- Purpose: make text pop up in windows via overlib
Smarty {html_select_date} plugin
Smarty tag: {html_select_date}
- Type: function
- Name: html_select_date
- Purpose: Prints the dropdowns for date selection.
Smarty {html_table} function plugin
Smarty tag: {html_table}
- Type: function
- Name: html_table
- Purpose: make an html table from an array of data
Input:
- 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}
Examples
<% $MyVar|bbcode2html %>
Smarty {math} function plugin
- Type: function
- Name: math
- Purpose: handle math computations in template
Smarty capitalize modifier plugin
- Type: modifier
- Name: capitalize
- Purpose: capitalize words in the string
Smarty {popup_init} function plugin
- Type: function
- Name: popup_init
- Purpose: initialize overlib
Smarty count_paragraphs modifier plugin
- Type: modifier
- Name: count_paragraphs
- Purpose: count the number of paragraphs in a text
Smarty cat modifier plugin
- Type: modifier
- Name: cat
- Purpose: catenate a value to a variable
Input: string to catenate
Example: {$var|cat:"foo"}
Smarty count_words modifier plugin
- Type: modifier
- Name: count_words
- Purpose: count the number of words in a text
Smarty count_characters modifier plugin
- Type: modifier
- Name: count_characteres
- Purpose: count the number of characters in a text
Smarty debug_print_var modifier plugin
- Type: modifier
- Name: debug_print_var
- Purpose: formats variable contents for display in the console
Smarty count_sentences modifier plugin
- Type: modifier
- Name: count_sentences
- Purpose: count the number of sentences in a text
Smarty date_format modifier plugin
- 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
Smarty escape modifier plugin
- Type: modifier
- Name: escape
- Purpose: Escape the string according to escapement type
Smarty lower modifier plugin
- Type: modifier
- Name: lower
- Purpose: convert string to lowercase
Smarty default modifier plugin
- Type: modifier
- Name: default
- Purpose: designate default value for empty variables
Smarty replace modifier plugin
- Type: modifier
- Name: replace
- Purpose: simple search/replace
Smarty strip_tags modifier plugin
- Type: modifier
- Name: strip_tags
- Purpose: strip html tags from text
Smarty indent modifier plugin
- Type: modifier
- Name: indent
- Purpose: indent lines of text
Smarty regex_replace modifier plugin
- Type: modifier
- Name: regex_replace
- Purpose: regular expression search/replace
Smarty string_format modifier plugin
- Type: modifier
- Name: string_format
- Purpose: format strings via sprintf
Smarty truncate_html modifier plugin
- 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.
escape_special_chars common function
- Function: smarty_function_escape_special_chars
- Purpose: used by other smarty functions to escape special chars except for already escaped ones
Smarty wordwrap modifier plugin
- Type: modifier
- Name: wordwrap
- Purpose: wrap a string of text at a given length
Smarty strip modifier plugin
- Type: modifier
- Name: strip
- Purpose: Replace all repeated spaces, newlines, tabs with a single space or supplied replacement string.
Example: {$var|strip} {$var|strip:" "}
Smarty plugin
- Type: modifier
- Name: nl2br
- Purpose: convert \r\n, \r or \n to <<br>>
Input:
- contents = contents to replace
- preceed_test = if true, includes preceeding break tags in replacement
Example: {$text|nl2br}
Smarty upper modifier plugin
- Type: modifier
- Name: upper
- Purpose: convert string to uppercase
Smarty truncate modifier plugin
- 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.
Smarty spacify modifier plugin
- Type: modifier
- Name: spacify
- Purpose: add spaces between characters in a string
Smarty trimwhitespace outputfilter plugin
- File: outputfilter.trimwhitespace.php
- Type: outputfilter
- Name: trimwhitespace
- 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 <code>$smarty->load_filter 'output','trimwhitespace');</code> from application.
Function: smarty_make_timestamp
- Purpose: used by other smarty functions to make a timestamp from a string.
Smarty {debug} function plugin
- Type: function
- Name: debug
- Purpose: popup debug window
