0
创建了一个简单的Smarty插件与下面的代码错误同时呼吁从TPL文件中的智者插件功能
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.assignmenu.php
* Type: function
* Name: assign
* Purpose: assign a value to a template variable
* -------------------------------------------------------------
*/
functionality-to-smarty-w-plugins/
function smarty_function_assignmenu(Smarty_Internal_Template $smarty)
{
//$template->assign($params['var'], $params['value']);
$smarty->assign('test', '123');
}
而这个功能从模板文件称为 {assignmenu} {测试}
虽然访问该页面时,将返回以下错误 传递给smarty_function_assignmenu()的参数1必须是Smarty_Internal_Template的实例,该实例在/var/www/myproject/runtime/Smarty/compile/cda404646b2153274a9e77f736531c5dc7e6f91c_0.file.sample.tpl中给出第31行的.php和d efined
我正在用yii2使用smarty 3。任何帮助表示赞赏