+ Reply to Thread
Results 1 to 2 of 2

Thread: How to remove "," in foreach()

  1. #1

    How to remove "," in foreach()

    Hi guys,

    I'm edited my field_out_value.tpl





    {if $item.Type == 'checkbox' && is_array($item.Values)}

    {foreach from=$item.Values item='tile' name='checkboxF'}
    {if !empty($item.Condition)}
    {assign var="tit_source" value=$tile.Key}
    {else}
    {assign var="tit_source" value=$tile.ID}
    {/if}
    {if $item.Opt1 || $tit_source|in_array:$item.source}
    <dd >{$lang[$tile.pName]},
    </dd>
    {/if}

    {/foreach}


    result is: a, b, c, d, e,

    How to remove "," in foreach()

    Exactly: a, b, c, d, e

  2. #2
    I found solution I share it here


    {if $item.Type == 'checkbox' && is_array($item.Values)}

    <dd class="multiple">{$item.value|rtrim:','}
    </dd>

    {/if}


    This solution to get Checkbox fields like :


    Option 1, Option 2, Option 3

+ Reply to Thread