我正在使用lightncandy来呈现我的handlebars templates服务器端,并且在一个帮助器上遇到了以下问题。这是js中的代码:
valOrIcon: function(prop) {
return ((typeof this[prop] !== 'undefined') && this[prop] !== null) ? this[prop] : unknown;
},如何将其转换为正确的PHP代码?因为我的助手方法在我的HandlebarsHelper.php类中都是静态方法,所以我不知道如何引用它。
发布于 2015-04-19 23:01:24
试试这个:
'hbhelpers' => Array(
'valOrIcon' => function($prop, $options) {
return isset($options['_this'][$prop]) ? $options['_this'][$prop] : 'unknown';
},
...
)需要lightncandy v0.20或更高版本。
https://stackoverflow.com/questions/28856697
复制相似问题