<?php
function smarty_function_url($params, &$smarty)
{
    global $config;
    
    $base       = $params['base'];
    $strip      = $params['strip'];
    $arg        = ( isset($params['value']) ) ? $params['value'] : NULL;
    $query      = NULL;
    
    foreach ( $_GET as $key => $value ) {
        if ( $key != $strip ) {
            $query .= '&' .$key. '=' .$value;
        }
    }
    
    if ( $arg ) {
        $query .= '&' .$strip. '=' .$arg;
    }
    
    if ( $query ) {
        $query = '?' .substr($query, 1);
    }
    
    return str_replace('&', '&amp;', $config['RELATIVE']. '/' .$base . $query);
}
?>
