문제

I've an array titled $preview_data assigned to smarty template as follows:

Array
(
  [applicable_states] => Array
        (
            [0] => 1
            [1] => 3
            [2] => 4
            [3] => 10
            [4] => 11
        )

)

Now I want to show the above array elements as comma separated values in a div element of a smarty template. In short it should behave like implode() in php. Can someone please help me in achieving this in smarty template? Thanks in advance.

도움이 되었습니까?

해결책

Try this:

{', '|implode:$preview_data.applicable_states}

It will give you what you are expecting. Cheers!!!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top