Utente: Password: Ricordami
Non sei ancora registrato? Puoi farlo adesso!. Come utente registrato avrai diversi vantaggi come la gestione dei temi grafici, la possibilità di inviare notizie e commenti.
MAXdev Italia - Funzioni smarty e MdLite
MAXdev Italia

Funzioni smarty e MdLite

cradle
md_pro

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.

 



Api (Application Programming Interface)
md_pro

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)

 




function.closetable


  Autorender plugin to return the html code for closetable()
 
  Available parameters:

  1.  - none


 
  Example


    <% closetable %>




modifier.pnvarprephtmldisplay

 

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




modifier.pnvarprepforstore

 

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




modifier.pnvarprepfordisplay

 

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




modifier.pnvarcensor

 

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




modifier.pnmodcallhooks

 

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:

  1. - modname:  The well-known name of the calling module; passed to the hook function
                    in the extrainfo array

  Example
 
    <% $MyVar|pnmodcallhooks %>




modifier.pndate_format

 

Autorender plugin to format datestamps via strftime according to locale setting in MAXdev




modifier.htmlspecialchars

 

  Autorender plugin to prepare a variable for display
  by converting special characters to HTML entities
 
  Example
 
    <% $MyVar|htmlspecialchars %>
  
 




function.tooltip

 

  Autorender display plugin to return a tooltip help icon
 
 
  Available parameters:

  1. - name: Required parameter, set this to the language variable for the tooltip content


  Example


  <% tooltip name="_languagevar" %>




function.pnversion

 

Autorender plugin to get the MAXdev version number
 
  available parameters:

  1. - assign      if set, the language will be assigned to this variable

  
  Examples


  <% pnversion %>
  <% pnversion assign="version" %>.... <% $version %>
 




function.pnvarcleanfrominput

 

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:

  1. - name: the name of the parameter
  2. - assign:   If set, the results are assigned to the corresponding variable instead of printed out

 




function.pnusergetvar

 

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:

  1. - name:    The name of the variable being requested
  2. - uid:     The user id to obtain the variable for - this parameter is optional
  3. - assign:  If set, the results are assigned to the corresponding variable instead of printed out

  
  Example


    <% pnusergetvar name="user_icq" uid=1|pnvarprepfordisplay %>




function.pnusergettheme

 

Autorender plugin to get the current users theme
 
  Available parameters:

  1. - assign:   If set, the results are assigned to the corresponding variable instead of printed out

  
  Examples


  <% pnusergettheme %>
  <% pnusergettheme assign="theme" %>....<% $theme %>




function.pnusergetlang

 

Autorender plugin to get the users language
 
  This function determines the recent users language
 
  Available parameters:

  1. - assign:  If set, the result is assigned to the corresponding variable instead of printed out

  
  Examples


    <% pnusergetlang %>
    <% pnusergetlang assign="lang" %>.... <% $lang %>
  
 




function.pnthemegetvar

 

Autorender plugin to get a colour definition from the theme
 
  This function returns the corresponding color define from the theme
 
  Available parameters:

  1. - name:    Name of the colour definition
  2. - 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 %>
  
 




function.pnsessionsetvar

 

  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:

  1. - name:    The name of the session variable to obtain
  2. - value:   The value for the session variable

  
  Example


    <% pnsessionsetvar name="foo" value="bar" %>
  
 




function.pnsessiongetvar

 

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:

  1. - name:    The name of the session variable to obtain
  2. - assign:  If set, the results are assigned to the corresponding variable instead of printed out

  
  Example


    <% pnsessiongetvar name="foobar"|pnvarprepfordisplay %>
  
 




function.pnsessiondelvar

 

Autorender plugin to delete a session variable
 
  This function deletes a session-specific variable from the system.
 
 
  Available parameters:

  1. - name:    The name of the session variable to delete
  2. - assign:  If set, the result is assigned to the corresponding variable instead of printed out

  
  Example


    <% pnsessiondelvar name="foobar" %>
  
 




function.pnsecgenauthkey

 

 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:

  1. - module:   The well-known name of a module to execute a function from (required)
  2. - 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" %>">
   




function.pnsecauthaction

 

Autorender plugin to check permissions
 


  Example:


  <% pnsecauthaction comp="Stories::" inst=".*" level="ACCESS_ADMIN" assign="auth" %>
  
     true/false will be returned
 




function.pnmodurl

 

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:

  1. - modname:  The well-known name of a module for which to create the URL (required)
  2. - type:     The type of function for which to create the URL; currently one of 'user' or 'admin' (default is 'user')
  3. - func:     The actual module function for which to create the URL (default is 'main')
  4. - ssl:      See below
  5. - assign:   If set, the results are assigned to the corresponding variable instead of printed out
  6. - 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>
 




function.pnmodishooked

 

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:

  1. - tmodname:  The well-known name of the hook module
  2. - smodname:  The well-known name of the calling module
  3. - 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 %>
  
 




function.pnmodgetvars

 

  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:

  1. - module:   The well-known name of a module from which to obtain the variable
  2. - name:     The name of the module variable to obtain
  3. - assign:   If set, the results are assigned to the corresponding variable instead of printed out

  
  Example


    <% pnmodgetvars module="Example" %>
 




function.pnmodgetvar

 

  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:

  1. - module:   The well-known name of a module from which to obtain the variable
  2. - name:     The name of the module variable to obtain
  3. - assign:   If set, the results are assigned to the corresponding variable instead of printed out


  
  Example


    <% pnmodgetvar module="Example" name="foobar" %>
 




function.pnmodgetname

 

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:

  1. - assign:   If set, the results are assigned to the corresponding
                    variable instead of printed out

  
  Example


    <% pnmodgetname|pnvarprepfordisplay %>




function.pnmodgetinfo

 

  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:

  1. - info        the information you want to retrieve from the modules info,"all" results in assigning all information, see $assign
  2. - 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
  3. - 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 %>
  
 




function.pnmodfunc

 

  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:

  1. - modname:  The well-known name of a module to execute a function from (required)
  2. - type:     The type of function to execute; currently one of 'user' or 'admin' (default is 'user')
  3. - func:     The name of the module function to execute (default is 'main')
  4. - assign:   If set, the results are assigned to the corresponding variable instead of printed out
  5.  - all remaining parameters are passed to the module function


  
  Example


  <% pnmodfunc modname="News" type="user" func="display" %>
 




function.pnmodcallhooks

 

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:

  1. - 'hookobject' the object the hook is called for - either 'item' or 'category'
  2. - 'hookaction' the action the hook is called for - one of 'create', 'delete', 'transform', or 'display'
  3. - 'hookid'     the id of the object the hook is called for (module-specific)
  4. - 'assign'     If set, the results are assigned to the corresponding variable instead of printed out
  5. - 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 %>




function.pnmodavailable

 

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:

  1. - modname:  The well-known name of a module to execute a function from (required)
  2. - assign:   The name of a variable to which the results are assigned


  
  Examples
    <% pnmodavailable modname="News" %>
 
    <% pnmodapifunc modname="foobar" assign="myfoo" %>
    <% if $myfoo %>.....<% /if %>
 




function.pnmodapifunc

 

 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:

  1. - modname:  The well-known name of a module to execute a function from (required)
  2. - type:     The type of function to execute; currently one of 'user' or 'admin' (default is 'user')
  3. - func:     The name of the module function to execute (default is 'main')
  4. - assign:   The name of a variable to which the results are assigned
  5. - 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 %>
 




function.pnimg

 

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:

  1. - src:           The file name of the image
  2. - modname:       The well-known name of a module (default: the current module)
  3. - width, height: If set, they will be passed. If none is set, they are obtained from the image
  4. - alt:           If not set, an empty string is being assigned
  5. - altml:         If true then alt string is assumed to be a ML constant
  6. - title:         If not set, an empty string is being assigned
  7. - titleml:       If true then title string is assumed to be a ML constant
  8. - assign:        If set, the results are assigned to the corresponding variable instead of printed out
  9. - optional       If set then the plugin will not return an error if an image is not found
  10. - default        If set then a default image is used should the requested image not be found (Note: full path required)
  11. - 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"  />
   
 




function.pngetstatusmsg

 

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:

  1. - assign:   If set, the status message is assigned to the corresponding variable instead of printed out
  2. - style, class: If set, the status message is being put in a div tag with the respective attributes
  3. - 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 %>
  
 




function.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 pngethost, the results of this function are already
  sanitized to display, so it should not be passed to the pnvarprepfordisplay modifier.
 
  Available parameters:

  1. - assign:   If set, the results are assigned to the corresponding variable instead of printed out


  
  Example


    <% pngethost %>
 




function.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 pngetcurrenturi, the results of this function are already
  sanitized to display, so it should not be passed to the pnvarprepfordisplay modifier.
 
  Available parameters:

  1. - assign:   If set, the results are assigned to the corresponding variable instead of printed out


  
  Example


    <% pngetcurrenturi %>
 




function.pngetbaseurl

 

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:

  1. - assign:   If set, the results are assigned to the corresponding variable instead of printed out


  
  Example


   <% pngetbaseurl %>
 




function.pnconfiggetvar

 

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:

  1. - name:     The name of the config variable to obtain
  2. - assign:   If set, the results are assigned to the corresponding variable instead of printed out


  
  Examples


    Welcome to <% pnconfiggetvar name="sitename" %>
  
 




function.pnblockshow

 

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:

  1. - module
  2. - blockname
  3. - block
  4. - assign:   If set, the results are assigned to the corresponding variable instead of printed out
     



function.pnblockgetinfo

  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:

  1. - bid: the block id
  2. - name: If set the name of the parameter to get otherwise the entire block array is assigned to the template
  3. - assign: If set, the results are assigned to the corresponding variable instead of printed out
      
     



function.pnblock

 

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:

  1. - id        id of block to be displayed
  2. - name      title of block to be displayed
  3. - title     Overwrites block title
  4. - position  Overwrites position (l,c,r)
  5. - assign:   If set, the results are assigned to the corresponding variable instead of printed out


 
  Example
    TBD
 




function.pnbannerdisplay

 

Autorender plugin to display a banner
  
 This function takes a identifier and returns a banner from the banners module
 
  Available parameters:

  1. - id:       id of the banner group as defined in the banners module
  2. - assign:   If set, the results are assigned to the corresponding variable instead of printed out


  
  Example


  <% pnbannerdisplay id=0 %>
 




function.pagerabc

 

 Autorender plugin to create alphabetical pagers
 
 
   Example:


     <% 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
 <span class="pager">
  <a class="header" href="index.php?module=Example&amp;abc=A,B">&nbspA,B
  </a> &nbsp;-&nbsp; <a class="dl" href="index.php?module=Example&amp;abc=C,D">&nbspC,D
  </a> &nbsp;-&nbsp; <a class="dl" href="index.php?module=Example&amp;abc=E,F">&nbspE,F
  </a> &nbsp;-&nbsp; <a class="dl" href="index.php?module=Example&amp;abc=G,H">&nbspG,H
  </a> &nbsp;-&nbsp; <a class="dl" href="index.php?module=Example&amp;abc=I,J">&nbspI,J
  </a> &nbsp;-&nbsp; <a class="dl" href="index.php?module=Example&amp;abc=K,L">&nbspK,L
  </a> &nbsp;-&nbsp; <a class="dl" href="index.php?module=Example&amp;abc=M,N,O">&nbspM,N,O
  </a> &nbsp;-&nbsp; <a class="dl" href="index.php?module=Example&amp;abc=P,Q,R">&nbspP,Q,R
  </a> &nbsp;-&nbsp; <a class="dl" href="index.php?module=Example&amp;abc=S,T">&nbspS,T
  </a> &nbsp;-&nbsp; <a class="dl" href="index.php?module=Example&amp;abc=U,V,W,X,Y,Z">&nbspU,V,W,X,Y,Z
  </a></span>
 
 
  Parameters:

  1. -string:     $posvar            - name of the variable that contains the position data, eg "letter"
  2. -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.
  3. -cvs:        $additionalvars   - comma- semicolon- or space-delimited list of additional variable and value pairs to forward in the links. eg "foo=2,bar=4"
  4. -string:     $class_num        - class for the pager links (<a> tags)
  5. -string:     $class_numon      - class for the active page
  6. -string:    $separator         - string to put between the letters, eg "|" makes | A | B | C | D |
  7. -string:     $printempty       - print empty sel ('-')
  8. -string:     $lang              - language
  9. -array:     $names            - values to select from (array or csv)
  10. -string     $skin              - use predefined values (hu - hungarian ABC)

 




function.pager

 

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" %>




function.opentable2

 

Autorender plugin to return the html code for opentable2()
 
  Available parameters:

  1. - none


 
  Example


    <% opentable2 %>
 




function.opentable

 

Autorender plugin to return the html code for opentable()
 
  Available parameters:

  1. - none


 
  Example


    <% opentable %>
 




function.languagelist

 

Autorender plugin to display a drop down list of languages
 
  Available parameters:

  1. - assign:   If set, the results are assigned to the corresponding variable instead of printed out
  2. - name:     Name for the control
  3. - selected: Selected value
  4. - installed: if set only show languages existing in languages folder


 
  Example


    <% languagelist name=language selected=eng installed=1 %>




function.img

  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:

  1. - src:           The file name of the image
  2. - modname:       The well-known name of a module (default: the current module)
  3. - width, height: If set, they will be passed. If none is set, they are obtained from the image
  4. - alt:           If not set, an empty string is being assigned
  5. - altml:         If true then alt string is assumed to be a ML constant
  6. - title:         If not set, an empty string is being assigned
  7. - titleml:       If true then title string is assumed to be a ML constant
  8. - assign:        If set, the results are assigned to the corresponding variable instead of printed out
  9. - optional       If set then the plugin will not return an error if an image is not found
  10. - default        If set then a default image is used should the requested image not be found (Note: full path required)
  11. - 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"  />
    
 




function.const

 

 Autorender plugin to return a language variable
 
  Available parameters:

  1. - 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'); 
 




function.closetable2

 

 Autorender plugin to return the html code for closetable2()
 
  Available parameters:

  1.  - none


 
  Example


    <% closetable2 %>
 




function.additional_header

 

Smarty function to add additional information to <head> </head>
 
 
 Available parameters:

  1.    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 %>

 

 

 




function.allowedhtml

 

Autorender plugin to display the list of allowed html tags
  
 Available parameters:

  1. assign:   If set, the results are assigned to the corresponding variable instead of printed out


  
  Examples

  •     <% allowedhtml %>
  •     <% allowedhtml assign="allowed" %>.....<% $allowed %>



function.adminmenulinks

 

Smarty function to display Admin Control Panel and Manual links with icons 
  
 

htmlpages


 <% adminmenulinks start="[" end="]" seperator="|" class="pn-menuitem-title" %>




function.adminmanual

 

Autorender display plugin to create link to the modules manual.


  
  
  Available parameters:

  1. manual:    name of manual file, manual.html if not set
  2. chapter:   an anchor in the manual file to jump to
  3. newwindow: opens the manual in a new window using javascript, default to on
  4. width:     width of the window if newwindow is set, default 600
  5. height:    height of the window if newwindow is set, default 400
  6. title:     name of the new window if newwindow is set, default is _ADMINMANUAL language define
  7. class:     class for use in the <a> tag
  8. 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 %>




Smarty_core
md_pro

Descrizione delle funzioni smarty




block.textformat.php

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)
     



compiler.assign.php

Smarty  compiler function plugin

Smarty tag: {assign}

  • Type:     compiler function
  • Name:     assign
  • Purpose:  assign a value to a template variable



function.assign_debug_info.php

Smarty  function plugin

Smarty tag: {assign_debug_info}

  •  Type:     function
  •  Name:     assign_debug_info
  •  Purpose:  assign debug info to the template



function.config_load.php

Smarty function plugin

Smarty tag: {config_load} 

  • Type:     function
  • Name:     config_load
  • Purpose:  load config file vars



function.counter.php

Smarty function plugin

Smarty tag: {counter}  
 

  • Type:     function
  • Name:     counter
  • Purpose:  print out a counter value



function.cycle.php

Smarty {cycle} function plugin

Smarty tag: {cycle}
 
 

  • Type:     function
  • Name:     cycle
  • Date:     May 3, 2002
  • Purpose:  cycle through given values

Input:

  1. name = name of cycle (optional)
  2. values = comma separated list of values to cycle,
                         or an array of values to cycle
                         (this can be left out for subsequent calls)
  3. reset = boolean - resets given var to true
  4. print = boolean - print var or not. default is true
  5. advance = boolean - whether or not to advance the cycle
  6. delimiter = the value delimiter, default is ","
  7. 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}
     



function.fetch.php

Smarty {fetch} plugin

Smarty tag: {fetch}
 

  •  Type:     function
  •  Name:     fetch
  •  Purpose:  fetch file, web or ftp data and display results



function.eval.php

Smarty {eval} function plugin

Smarty tag: {eval}

  • Type:     function
  • Name:     eval
  • Purpose:  evaluate a template variable as a template



function.html_image.php

Smarty {html_image} function plugin

Smarty tag: {html images}
 
 

  • Type:     function
  • Name:     html_image
  • Purpose:  format HTML tags for the image


  Input:

  1. file = file (and path) of image (required)
  2. height = image height (optional, default actual height)
  3. width = image width (optional, default actual width)
  4. basedir = base directory for absolute paths, default
                         is environment variable DOCUMENT_ROOT
  5. 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>



function.html_checkboxes.php

Smarty {html_checkboxes} function plugin

Smarty tag: {html_checkboxes} 

  •  Type:       function
  •  Name:       html_checkboxes
  •  Purpose:    Prints out a list of checkbox input types


  Input:

  1. name       (optional) - string default "checkbox"
  2. values     (required) - array
  3. options    (optional) - associative array
  4. checked    (optional) - array default not set
  5. separator  (optional) - ie <br> or &nbsp;
  6. output     (optional) - the output next to each checkbox
  7. 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}
 




function.html_radios.php

Smarty {html_radios} function plugin

Smarty tag: {html_radios}

  • Type:       function
  • Name:       html_radios
  • Purpose:    Prints out a list of radio input types

  Input:

  1. name       (optional) - string default "radio"
  2. values     (required) - array
  3. options    (optional) - associative array
  4. checked    (optional) - array default not set
  5. separator  (optional) - ie <br> or &nbsp;
  6. output     (optional) - the output next to each radio button
  7. 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}




function.html_options.php

Smarty {html_options} function plugin

Smarty tag: {html_options}
 

  • Type:     function
  • Name:     html_options

  Input:

  1. name       (optional) - string default "select"
  2. values     (required if no options supplied) - array
  3. options    (required if no values supplied) - associative array
  4. selected   (optional) - string default not set
  5. output     (required if not options supplied) - array
     

Purpose:  Prints the list of <option> tags generated from the passed parameters




function.html_select_time.php

Smarty {html_select_time} function plugin

Smarty tag: {html_select_time}

  • Type:     function
  • Name:     html_select_time
  • Purpose:  Prints the dropdowns for time selection



function.mailto.php

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:

  1. address = e-mail address
  2. text = (optional) text to display, default is address
  3. 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"'}
 




function.popup.php

Smarty {popup} function plugin

Smarty tag: {popup}

  •  type:     function
  •  Name:     popup
  •  Purpose:  make text pop up in windows via overlib



function.html_select_date.php

Smarty {html_select_date} plugin

Smarty tag: {html_select_date}

  • Type:     function
  • Name:     html_select_date
  • Purpose:  Prints the dropdowns for date selection.



function.html_table.php

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:

  1. loop = array to loop through
  2. cols = number of columns, comma separated list of column names or array of column names
  3. rows = number of rows
  4. table_attr = table attributes
  5. th_attr = table heading attributes (arrays are cycled)
  6. tr_attr = table row attributes (arrays are cycled)
  7. td_attr = table cell attributes (arrays are cycled)
  8. trailpad = value to pad trailing cells with
  9. caption = text for caption element
  10. vdir = vertical direction (default: "down", means top-to-bottom)
  11. hdir = horizontal direction (default: "right", means left-to-right)
  12. 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}
 




modifier.bbcode2html.php
 Autorender plugin to Converts BBCode style tags to HTML
 
 
Examples
    <% $MyVar|bbcode2html %>


function.math.php

Smarty {math} function plugin

  • Type:     function
  • Name:     math
  • Purpose:  handle math computations in template



modifier.capitalize.php

Smarty capitalize modifier plugin

  • Type:     modifier
  • Name:     capitalize
  • Purpose:  capitalize words in the string



function.popup_init.php

Smarty {popup_init} function plugin

  • Type:     function
  • Name:     popup_init
  • Purpose:  initialize overlib



modifier.count_paragraphs.php

Smarty count_paragraphs modifier plugin

  • Type:     modifier
  • Name:     count_paragraphs
  • Purpose:  count the number of paragraphs in a text



modifier.cat.php

Smarty cat modifier plugin

  • Type:     modifier
  • Name:     cat
  • Purpose:  catenate a value to a variable

Input:    string to catenate

Example:  {$var|cat:"foo"}




modifier.count_words.php

Smarty count_words modifier plugin

  • Type:     modifier
  • Name:     count_words
  • Purpose:  count the number of words in a text



modifier.count_characters.php

Smarty count_characters modifier plugin

  • Type:     modifier
  • Name:     count_characteres
  • Purpose:  count the number of characters in a text



modifier.debug_print_var.php

Smarty debug_print_var modifier plugin

  • Type:     modifier
  • Name:     debug_print_var
  • Purpose:  formats variable contents for display in the console



modifier.count_sentences.php

Smarty count_sentences modifier plugin

  • Type:     modifier
  • Name:     count_sentences
  • Purpose:  count the number of sentences in a text



modifier.date_format.php

Smarty date_format modifier plugin

  • Type:     modifier
  • Name:     date_format
  • Purpose:  format datestamps via strftime


 Input:

  1. string: input date string
  2. format: strftime format for output
  3. default_date: default date if $string is empty



modifier.escape.php

Smarty escape modifier plugin

  • Type:     modifier
  • Name:     escape
  • Purpose:  Escape the string according to escapement type



modifier.lower.php

Smarty lower modifier plugin

  • Type:     modifier
  • Name:     lower
  • Purpose:  convert string to lowercase



modifier.default.php

Smarty default modifier plugin

  • Type:     modifier
  • Name:     default
  • Purpose:  designate default value for empty variables



modifier.replace.php

Smarty replace modifier plugin

  • Type:     modifier
  • Name:     replace
  • Purpose:  simple search/replace



modifier.strip_tags.php

Smarty strip_tags modifier plugin

  • Type:     modifier
  • Name:     strip_tags
  • Purpose:  strip html tags from text



modifier.indent.php

Smarty indent modifier plugin

  • Type:     modifier
  • Name:     indent
  • Purpose:  indent lines of text



modifier.regex_replace.php

Smarty regex_replace modifier plugin

  • Type:     modifier
  • Name:     regex_replace
  • Purpose:  regular expression search/replace



modifier.string_format.php

Smarty string_format modifier plugin

  • Type:     modifier
  • Name:     string_format
  • Purpose:  format strings via sprintf



modifier.truncate_html.php

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.



shared.escape_special_chars.php

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



modifier.wordwrap.php

Smarty wordwrap modifier plugin

  • Type:     modifier
  • Name:     wordwrap
  • Purpose:  wrap a string of text at a given length



modifier.strip.php

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:"&nbsp;"}




modifier.nl2br.php

Smarty plugin

  • Type:     modifier
  • Name:     nl2br
  • Purpose:  convert \r\n, \r or \n to <<br>>


 Input:

  1. contents = contents to replace
  2. preceed_test = if true, includes preceeding break tags in replacement


Example:  {$text|nl2br}




modifier.upper.php

Smarty upper modifier plugin

  • Type:     modifier
  • Name:     upper
  • Purpose:  convert string to uppercase



modifier.truncate.php

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.



modifier.spacify.php

Smarty spacify modifier plugin

  • Type:     modifier
  • Name:     spacify
  • Purpose:  add spaces between characters in a string



outputfilter.trimwhitespace.php

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.




shared.make_timestamp.php

Function: smarty_make_timestamp

  • Purpose:  used by other smarty functions to make a timestamp from a string.



function.debug.php

 Smarty {debug} function plugin

  • Type:     function
  • Name:     debug
  • Purpose:  popup debug window


2008 ©  MAXdev Italia