function.issex.php 785 Bytes
<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */


/**
 * Smarty {math} function plugin
 *
 * Type:     function<br>
 * Name:     math<br>
 * Purpose:  handle math computations in template<br>
 * @link http://smarty.php.net/manual/en/language.function.math.php {math}
 *          (Smarty online manual)
 * @author   Monte Ohrt <monte at ohrt dot com>
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_issex($params, &$smarty)
{

$filter = (isset($_GET['sex']) && strlen($_GET['sex'])>0) ? $_GET['sex'] : array();
$l = explode(';',$filter);
$f = 0;
$params['n'] = str_replace(",", ".", $params['n']);
foreach($l as $key=>$q){
 if($params['s']==$q){$f++;}
}

if($f==0) return;
else return 'checked';
}

/* vim: set expandtab: */

?>