<?php
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:    modifier
 * Name:    join
 * Version:    0.1
 * Date:    2003-02-21
 * Author:    Joscha Feth, joscha@feth.com
 * Purpose: joins an array to a string with a given delimiter
 * Usage:    In the template, use 
            {$somearray|join}                =>    1,2,3,4,5
            or
            {$somearray|join:"|"}            =>    1|2|3|4|5
 * Params:    
            string    delimiter    the string with which the ending string shall be delimited
 * Return:    string    
 * Install: Drop into the plugin directory
 * -------------------------------------------------------------
 */
function smarty_modifier_join($arr,$delimiter ',')
{    
    if(!
is_array($arr)) {
        return 
$arr;
    } else {
        return 
join($delimiter,$arr);
    }
}