Yii2-Smarty: Cannot Access Methods of $this-object -
yii2-smarty: cannot access object methods
i set yii2 smarty extension.
now trying convert layouts/main.php
file smarty template. need access current yii\web\view
object given extension $this
-smarty-variable.
i've validated smarty $this
variable same view-object through var_dump()
-ing , comparing both.
problem
according smarty3 docs should able call method on $this
-object smarty templates this: {var_dump($this->head())}
.
applying above script in template returns null
let me guess no method call had happen.
question
how can call method object given smarty php ?
- define variable use in smarty:
$template->assign('app', \yii::$app);
- call method on variable in smarty template:
{$app->getsession();}
what doing wrong ?
(my current smarty layout: pastebin)
applying above script in template returns null let me guess no method call had happen.
the head() method not return if see null correct.
you can call method this:
{$this->head()}
Comments
Post a Comment