* Name: math
* Purpose: handle math computations in template
* @link http://smarty.php.net/manual/en/language.function.math.php {math} * (Smarty online manual) * @author Monte Ohrt * @param array * @param Smarty * @return string */ function smarty_function_url($params, &$smarty) { // print_r($_SERVER); $url = preg_replace('/'.$params['var'].'=([0-9]+)/i',null,$_SERVER['REQUEST_URI']); // $url = (substr($url,-1,1)=='/')?$url:$url.'/'; // return (substr($url,-1,1)=='&' or substr($url,-1,1)=='?')?$url:$url.'?'; return (strpos($url,'?'))?((substr($url,-1,1)=='?')?$url:((substr($url,-1,1)=='&')?$url:$url.'&')):((substr($url,-1,1)=='/')?$url.'?':$url.'/?'); } /* vim: set expandtab: */ ?>