⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 formselect.func.php

📁 phpcms2007很好的cms内容管理系统,操作方便
💻 PHP
字号:
<?php

function brand_select($name = 'brandselect',$onlyoptionlabel=1, $brand_id = 0, $alt, $property = '',$valuetype = 'name')
{
	global $BRANDS;
	$brandselect = '';
	foreach ($BRANDS as $k=>$brand)
	{
		$selected = $k == $brand_id ? 'selected' : '';
		if($valuetype == 'name')		
		{
			$brandselect .= "<option value='".$brand['brand_name']."' ".$selected.">".$brand['brand_name']."</option>\n";
		}
		else 
		{
			$brandselect .= "<option value='".$brand['brand_id']."' ".$selected.">".$brand['brand_name']."</option>\n";
		}
	}
	if(!$onlyoptionlabel)
	{
		$brandselect="<select name='".$name."' ".$property.">\n<option value=''>".$alt."</option>\n".$brandselect.
					 "</select>";
	}
	return $brandselect;
}

function property_select($name = 'propertyselect', $alt, $property = '',$pro_id=0)
{
	global $db;
	$res=$db->query("SELECT pro_id,pro_name FROM ".TABLE_PRODUCT_PROPERTY." WHERE disabled=0 Order by pro_id desc");
	$propertyselect="";
	if(mysql_num_rows($res)>0)
	{
		while($r=$db->fetch_array($res))
		{
			$propertyselect.="<option value='".$r['pro_id']."' ";
			if($pro_id == $r['pro_id']) $propertyselect.=" selected ";
			$propertyselect.=">".$r['pro_name']."</option>\n";
		}
	}
	
	$propertyselect="<select name='".$name."' ".$property.">\n<option value='0'>".$alt."</option>\n".$propertyselect.
					 "</select>";	

	$db->free_result($res);
	return $propertyselect;
}


function product_urlrule_select($name, $fileext = 'html', $type = 'cat', $urlruleid = 0, $property = '')
{
	global $mod,$LANG;
	if(!$name) return true;
	include PHPCMS_ROOT."/$mod/include/urlrule.inc.php";
	$string = "<select name=\"".$name."\" ".$property.">\n";
	for($i=0; $i<count($urlrule[$fileext][$type]); $i++)
	{
		$selected = $i==$urlruleid ? " selected=\"selected\"" : "";
		$string.="<option value=\"".$i."\"".$selected.">".$LANG['example'].":".$urlrule[$fileext][$type][$i]['example']."</option>\n";
	}
	$string.="</select>\n";
	return $string;
}

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -