PHP Smarty 函数插件(自定义函数)html_options

html_options,用于生成下拉列表

常见属性如下图:

PHP Smarty 函数插件(自定义函数)html_options_第1张图片


select.php(后端):

template_dir = "templates";
$smarty->compile_dir = "templates_c";


$man = array(
	5 => '张三',
	6 => '梅兰芳',
	7 => '张学良',
	8 => '李四'
);
$smarty->assign('man',$man);
$smarty->display('select.tpl');
select.tpl(前端视图):




	
	Document


	
	

html_options的用法

{html_options name = 'man' options = $man selected = 6} {* options=关联数组,关联数组的下标分配给values,数组的值对应显示出来的部分 *}


你可能感兴趣的:(PHP,php,smarty,模板引擎)