Loading...
 
Skip to main content

History: PluginSmarty

Source of version: 17 (current)

Copy to clipboard
            ! Plugin Smarty
''Introduced in ((Tiki5))''

Use this ((wiki plugin)) to insert a [http://www.smarty.net/docs/en/|Smarty] function in a page. Smarty is the template engine used in Tiki.

!! Parameters
{pluginmanager plugin="smarty"}
In addition, the smarty function parameters that are required or allowed should or may be set. The functions available can be found as separate files on the server for each function (name) as follows:
* -+lib/smarty_tiki/function.(name).php+-
* -+vendor/smarty/libs/plugins/function.(name).php+-
!! Examples
!!!Function to add a button
''This code:''
{CODE(colors="tiki")}
{smarty name="button" href="Search" _text="Search"}
{CODE}

''Would produce:''
{smarty name="button" href="Search" _text="Search"}
!!!Variables
Smarty variables can be displayed by using the -+eval+- Smarty function. The available Smarty variables for a page can be viewed by Admins by clicking the "Smarty debug window" option in the Quick Administration menu. Or add -+?show_smarty_debug=1+- to the page address (or -+&show_smarty_debug=1+- if there are already other url parameters). See below examples.

!!!!Smarty variables - page name
''This code:''
{CODE(colors="tiki")}{smarty name="eval" var="{$page}"} {CODE}

''Would produce on this page:''
{smarty name="eval" var="{$page}"}

!!!!Smarty global variables - domain name
Global variables can be accessed too, such as the domain name - 
''This code:''
{CODE(colors="tiki")}{smarty name="eval" var="{$smarty.server.HTTP_HOST}"}{CODE}

''Would produce on this site:''
{smarty name="eval" var="{$smarty.server.HTTP_HOST}"}

!!!! Preferences - metatag keywords
''This code:''
{CODE(colors="tiki")}{smarty name="eval" var="{$prefs.metatag_keywords}"} {CODE}

''Would produce on this site:''
{smarty name="eval" var="{$prefs.metatag_keywords}"} 
!!Related pages
* ((PluginShowPref))