0

次のカスタム smarty 関数を使用したい:

function smarty_function_heading($params){
  return $params[0]->getHeading(LANG);
}

私のテンプレートでは、この関数を次のように使用しようとしています。

{heading $page}

しかし、次のエラーが表示されます。

Uncaught --> Smarty Compiler: Syntax error in template "test.smarty" on line 19 "<h1>{heading $page}</h1>" too many shorthand attributes <-- thrown in smarty-3.1.16/sysplugins/smarty_internal_templatecompilerbase.php on line 19

単一の引数で smarty 関数を使用する正しい方法を教えてもらえますか?

ありがとう!

注意: {heading page=$page} のように smarty 関数を使用する方法は知っていますが、この方法は使用したくありません。誰かがアイデアを持っていることを願っています。

4

1 に答える 1