Suchbox-Einstellungen |
Zielseite mit Suchmodul: |
|
get($range, "href");
//parse address value
if (preg_match("/^([^:]+):(.+)$/s", $address, $_address))
{
$type = $_address[1]; //type of reference
$address = $_address[2]; //address of reference
//process reference
switch ($type)
{
case "directory":
case "content":
$address = "$type://$address";
break;
default:
case "address":
break;
};
};
//retrieve tags
cms_load("search");
$search = new search();
$list = (array)$search->tag(NULL, $count);
if (count($list) === 0) return; //no elements
//initialize
$score_max = max($list);
$score_min = min($list);
$score_diff = $score_max - $score_min;
$factor = ($size_max - $size_min) / $score_diff;
$red_min = hexdec(substr($color_min, 0, 2));
$green_min = hexdec(substr($color_min, 2, 2));
$blue_min = hexdec(substr($color_min, 4, 2));
$red_max = hexdec(substr($color_max, 0, 2));
$green_max = hexdec(substr($color_max, 2, 2));
$blue_max = hexdec(substr($color_max, 4, 2));
$red = ($red_max - $red_min) / $score_diff;
$green = ($green_max - $green_min) / $score_diff;
$blue = ($blue_max - $blue_min) / $score_diff;
//order by tag
ksort($list);
//display
reset($list);
while (list($key, $value) = each($list))
{
$score = $value - $score_min;
$size = $size_min + round($factor * $score, 2);
$color = sprintf("%02x", $red_min + $red * $score) .
sprintf("%02x", $green_min + $green * $score) .
sprintf("%02x", $blue_min + $blue * $score);
$_address = translate_url($address, array("search_term" => $key));
echo("" .
x($key) .
" ");
};
?>