Class yii\smarty\Extension

Inheritanceyii\smarty\Extension
Source Code https://github.com/yiisoft/yii2-smarty/blob/master/Extension.php

Extension provides Yii-specific syntax for Smarty templates.

Public Methods

Hide inherited methods

MethodDescriptionDefined 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

Hide inherited methods

MethodDescriptionDefined By
getViewConstVal() Helper function to convert a textual constant identifier to a View class integer constant value. yii\smarty\Extension

Property Details

$smarty protected property
\Smarty $smarty null
$viewRenderer protected property

Method Details

__construct() public method

void __construct$viewRenderer$smarty )
$viewRenderer yii\smarty\ViewRenderer
$smarty \Smarty
blockCss() public method

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.

string blockCss$params$content$template, <b>&</b>$repeat )
$params
$content
$template \Smarty_Internal_Template
$repeat
blockDescription() public method

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.

string blockDescription$params$content$template, <b>&</b>$repeat )
$params
$content
$template \Smarty_Internal_Template
$repeat
blockJavaScript() public method

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'.

string blockJavaScript$params$content$template, <b>&</b>$repeat )
$params
$content
$template \Smarty_Internal_Template
$repeat
blockTitle() public method

Smarty block function plugin Usage is the following:

{title} Web Site Login {/title}

Supported attributes: none.

string blockTitle$params$content$template, <b>&</b>$repeat )
$params
$content
$template \Smarty_Internal_Template
$repeat
compilerUse() public method

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'.

string compilerUse$params$template )
$params
$template \Smarty_Internal_Template
functionMeta() public method

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.

string functionMeta$params$template )
$params
$template \Smarty_Internal_Template
functionPath() public method

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.

string functionPath$params, \Smarty_Internal_Template $template )
$params array
$template \Smarty_Internal_Template
functionRegisterCssFile() public method

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.

string functionRegisterCssFile$params$template )
$params
$template \Smarty_Internal_Template
functionRegisterJsFile() public method

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'.

string functionRegisterJsFile$params$template )
$params
$template \Smarty_Internal_Template
functionSet() public method

Smarty function plugin Usage is the following:

{set title="My Page"} {set theme="frontend"} {set layout="main.tpl"}

Supported attributes: title, theme, layout

string functionSet$params$template )
$params
$template \Smarty_Internal_Template
functionUrl() public method

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.

string functionUrl$params, \Smarty_Internal_Template $template )
$params array
$template \Smarty_Internal_Template
getViewConstVal() protected method

Helper function to convert a textual constant identifier to a View class integer constant value.

mixed getViewConstVal$string$default )
$string string

Constant identifier name

$default integer

Default value

modifierVoid() public method

Smarty modifier plugin Converts any output to void

string modifierVoid$arg )
$arg mixed