This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/includes/smarty/plugins/function.html_bool.php

28 lines
648 B
PHP
Raw Normal View History

<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: function.html_bool
* Type: function
* Name: html_bool
* -------------------------------------------------------------
*/
function smarty_function_html_bool($params, &$smarty)
{
extract($params);
if(empty($id)) $id = $field;
if(empty($value)) $value = '1';
$extra=' ';
if(!empty($onclick)) $extra .= ' onClick="'.$onclick.'" ';
if($default == $value) $extra .= 'checked ';
$ret = '<input type="checkbox" name="'.$field.'" id="'.$id.'" value="'.$value.'"'.$extra.'/>';
return $ret;
}
?>