【php开源代码栏目提醒】:网学会员鉴于大家对php开源代码十分关注,论文会员在此为大家搜集整理了“function.html_action.php”一文,供大家参考学习
<?php
function tpl_function_html_action($params, &$smarty)
{
//require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
if(array_key_exists("id",$params)){
$value = $params['id'];
} else {
$smarty->trigger_error("html_action: value key is required", E_USER_NOTICE);
}
foreach($params as $_key=>$_val){
switch($_key){
case 'del':
$del_action = true;
break;
case 'edit':
$edit_action = true;
break;
default:
if(!is_array($_val)) {
$extra .= '&'.$_key.'='.$_val;//smarty_function_escape_special_chars($_val);
} else {
$smarty->trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
break;
}
}
if($edit_action){
$_html_result = "[<a href=\"?action=edit$extra\">编辑</a>]";
}
if($del_action){
$_html_result .= "[<a href=\"?action=del$extra\">删除</a>]";
}
return $_html_result;
}
?>