Smarty getting substring of a var with strpos as start and strlen as end

后端 未结 4 1346
面向向阳花
面向向阳花 2021-01-12 02:00

I am having issue formatting variables in smarty. I was wondering what is the best way to do it. Basically i have a string \"ABC | DEFGH\" i want smarty to get the substri

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-12 02:17

    Those functions do not exist in smarty. You'll have to split it in PHP before sending it to the template. Or you could write your own split function smarty plugin. Or use {php} tags in the template, but I'd avoid that solution as it is against the 'spirit' and purpose of using smarty, separation of presentation and logic, etc etc.

提交回复
热议问题