开发者

Smarty must have the variables in `backticks`

I am trying to add 2 variable together inside of an assign. When reading the Sma开发者_开发百科rty Assign Documentation it says: This complex example must have the variables in backticks, what does this mean?


It is the following sign `

So you have

 assign variable = `value`


According to the official Smarty documentation,

  • Smarty will recognize assigned variables embedded in "double quotes" so long as the variable name contains only numbers, letters, under_scores and brackets[].
  • With any other characters, for example a .period or $object->reference, then the variable must be surrounded by `backticks`.

In particular, if you are doing maths in, say, an assign, you need to use backticks for it to work.


backticks are only necessary when inside quotes, and when you have variables with characters such as . -> example:

{assign var="foo" value="myval is `$smarty.request.myval`"}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜