13

can some 1 tell how to break this sort of String in smarty what i want is "1" as price and "dollar" as currency type.

"1|dollar"

please reply.

temp-learn
  • 527
  • 2
  • 9
  • 31

1 Answers1

32

You could do something like this:

{assign var=someVar value="|"|explode:"1|dollar"}

and then access "1" and "dollar" through 0 and 1 indexes of the "someVar" variable like below,

{$somevar[0]} and {$somevar[1]}

manian
  • 1,418
  • 2
  • 16
  • 32
Jan Hančič
  • 53,269
  • 16
  • 95
  • 99