www.gusucode.com > 同城苏州黄页系统php源码程序 > lib/smarty/plugins/modifier.realText.php

    <?php

function showBoxValue($value,$boxList,$max=0,$separator=',')
{
	$boxList=cutdownArr($boxList);
	$value=explode($separator,$value);
	$newValue=array();
	$cnt=0;
	foreach($value as $item)
	{
		if( $cnt>=$max and $max>0 )
		{
			$newValue[]='...';
			break;
		}

		if( isset($boxList[$item]) )
			$newValue[]=str_replace(' ','',$boxList[$item]);
		else
			$newValue[]=str_replace(' ','',$item);
		$cnt++;
	}
	
	return implode('/',$newValue);
}

function smarty_modifier_realText($str,$file,$arrName)
{
	global $root_path;
	$realfile=$root_path.'admin/'.$file;
	if(!file_exists($realfile))
		return "模版錯誤(使用調節器 realText 時):文件不存在 $file ,請檢查書寫,在Linux 平臺上區分大小寫。";
	
	include $realfile;
	if( !isset($$arrName) )
		return "模版錯誤(使用調節器 realText 時):指定的映射表 $arrName 不存在,請檢查書寫,注意區分大小寫。";
	
	$re=showBoxValue($str,$$arrName);
	if($re=='請選擇')
		$re='不限';
	return $re;
}
?>