php - Prepending a string to a Smarty variable -


i'm looking way prepend string smarty variable. have dynamic form having element-names input-1 (where 1 id of setting/field).

i've tried {capture}{/capture} seems work first time (as fields displayed loop).

is there opposite function |cat:'text' smarty, or have to:

  1. create own modifier
  2. rename inputs

i'm not sure understand you're trying achieve, there alternative syntax cat, using backticks (and more elegant , clear imho):

using cat:

{"my string"|cat:$my_var|cat:"other string"|cat:$other_var} 

the same, using bacticks:

{"my string `$my_var` other string `$other_var`"} 

using backticks, can place variables anywhere inside string:

{"input-`$id`"} 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -