Search code examples
smarty

Concatenation in smarty


I want to assign the value obtained from the concatenation of these two variables with a string.

{assign var="url" value="{$WS_PATH}aircraft_images/{$images[i].image}"}

Please let me know how can we do this in smarty.


Solution

  • One of these should work:

    {assign var="url" value=$WS_PATH|cat:"aircraft_images/"|cat:$images[i].image}
    

    Or

    {assign var="url" value="`$WS_PATH`aircraft_images/`$images[i].image`"}
    

    I am not sure if the $images[i].image will be parsed correctly, you may have to {assign} it to another variable first