Class yii\smarty\Extension
| Inheritance | yii\smarty\Extension |
|---|
Extension provides Yii-specific syntax for Smarty templates.
Protected Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $smarty | \Smarty | yii\smarty\Extension | |
| $viewRenderer | yii\smarty\ViewRenderer | yii\smarty\Extension |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | yii\smarty\Extension | |
| blockCss() | Smarty block function plugin Usage is the following: | yii\smarty\Extension |
| blockDescription() | Smarty block function plugin Usage is the following: | yii\smarty\Extension |
| blockJavaScript() | Smarty block function plugin Usage is the following: | yii\smarty\Extension |
| blockTitle() | Smarty block function plugin Usage is the following: | yii\smarty\Extension |
| compilerUse() | Smarty compiler function plugin Usage is the following: | yii\smarty\Extension |
| functionMeta() | Smarty function plugin Usage is the following: | yii\smarty\Extension |
| functionPath() | Smarty template function to get relative URL for using in links | yii\smarty\Extension |
| functionRegisterCssFile() | Smarty function plugin Usage is the following: | yii\smarty\Extension |
| functionRegisterJsFile() | Smarty function plugin Usage is the following: | yii\smarty\Extension |
| functionSet() | Smarty function plugin Usage is the following: | yii\smarty\Extension |
| functionUrl() | Smarty template function to get absolute URL for using in links | yii\smarty\Extension |
| modifierVoid() | Smarty modifier plugin Converts any output to void | yii\smarty\Extension |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| getViewConstVal() | Helper function to convert a textual constant identifier to a View class integer constant value. | yii\smarty\Extension |
Property Details
Method Details
| public void __construct ( $viewRenderer, $smarty ) | ||
| $viewRenderer | yii\smarty\ViewRenderer | |
| $smarty | \Smarty | |
Smarty block function plugin Usage is the following:
{registerCss} div.header {
background-color: #3366bd;
color: white;
} {/registerCss}
Supported attributes: key and valid HTML attributes for the style tag. Refer to Yii documentation for details.
| public string blockCss ( $params, $content, $template, &$repeat ) | ||
| $params | ||
| $content | ||
| $template | \Smarty_Internal_Template | |
| $repeat | ||
Smarty block function plugin Usage is the following:
{description}
The text between the opening and closing tags is added as
meta description tag to the page output.
{/description}
Supported attributes: none.
| public string blockDescription ( $params, $content, $template, &$repeat ) | ||
| $params | ||
| $content | ||
| $template | \Smarty_Internal_Template | |
| $repeat | ||
Smarty block function plugin Usage is the following:
{registerJs key='show' position='POS_LOAD'}
$("span.show").replaceWith('<div class="show">');
{/registerJs}
Supported attributes: key, position. Refer to Yii documentation for details. The position attribute is passed as text without the class prefix. Default is 'POS_READY'.
| public string blockJavaScript ( $params, $content, $template, &$repeat ) | ||
| $params | ||
| $content | ||
| $template | \Smarty_Internal_Template | |
| $repeat | ||
Smarty block function plugin Usage is the following:
{title} Web Site Login {/title}
Supported attributes: none.
| public string blockTitle ( $params, $content, $template, &$repeat ) | ||
| $params | ||
| $content | ||
| $template | \Smarty_Internal_Template | |
| $repeat | ||
Smarty compiler function plugin Usage is the following:
{use class="app\assets\AppAsset"} {use class="yii\helpers\Html"} {use class='yii\widgets\ActiveForm' type='block'} {use class='@app\widgets\MyWidget' as='my_widget' type='function'}
Supported attributes: class, as, type. Type defaults to 'static'.
| public string compilerUse ( $params, $template ) | ||
| $params | ||
| $template | \Smarty_Internal_Template | |
Smarty function plugin Usage is the following:
{meta keywords="Yii,PHP,Smarty,framework"}
Supported attributes: any; all attributes are passed as parameter array to Yii's registerMetaTag function.
| public string functionMeta ( $params, $template ) | ||
| $params | ||
| $template | \Smarty_Internal_Template | |
Smarty template function to get relative URL for using in links
Usage is the following:
{path route='blog/view' alias=$post.alias user=$user.id}
where route is Yii route and the rest of parameters are passed as is.
| public string functionPath ( $params, \Smarty_Internal_Template $template ) | ||
| $params | array | |
| $template | \Smarty_Internal_Template | |
Smarty function plugin Usage is the following:
{registerCssFile url='@assets/css/normalizer.css'}
Supported attributes: url, key, depends and valid HTML attributes for the link tag. Refer to Yii documentation for details.
| public string functionRegisterCssFile ( $params, $template ) | ||
| $params | ||
| $template | \Smarty_Internal_Template | |
Smarty function plugin Usage is the following:
{registerJsFile url='http://maps.google.com/maps/api/js?sensor=false' position='POS_END'}
Supported attributes: url, key, depends, position and valid HTML attributes for the script tag. Refer to Yii documentation for details. The position attribute is passed as text without the class prefix. Default is 'POS_END'.
| public string functionRegisterJsFile ( $params, $template ) | ||
| $params | ||
| $template | \Smarty_Internal_Template | |
Smarty function plugin Usage is the following:
{set title="My Page"} {set theme="frontend"} {set layout="main.tpl"}
Supported attributes: title, theme, layout
| public string functionSet ( $params, $template ) | ||
| $params | ||
| $template | \Smarty_Internal_Template | |
Smarty template function to get absolute URL for using in links
Usage is the following:
{url route='blog/view' alias=$post.alias user=$user.id}
where route is Yii route and the rest of parameters are passed as is.
| public string functionUrl ( $params, \Smarty_Internal_Template $template ) | ||
| $params | array | |
| $template | \Smarty_Internal_Template | |
Helper function to convert a textual constant identifier to a View class integer constant value.
| protected mixed getViewConstVal ( $string, $default ) | ||
| $string | string | Constant identifier name |
| $default | integer | Default value |
Smarty modifier plugin Converts any output to void
| public string modifierVoid ( $arg ) | ||
| $arg | mixed | |