tagadelic et tagadelic.level1

Catégories:

Bonjour à tous,

Savez vous comment fonctionne le mécanisme d’attribution de la taille (tagadelic.level1) des mots clés dans le blog TAG ?

Au bout de combien d’affichage d’une page(avec mots clés)cela augmente t il la taille des mots clés ? (tagadelic.level1 en tagadelic.level2)

J’espère que vous m’avez compris ? Et oui même je m’y perds …

#

Personne ne peux m’éclairer ?

#

En regardant dans le .module

<?php
/**
* API that returns an array with weighted tags
* This is the hard part. People with better ideas are very very welcome to send these to ber@webschuur.com. Distribution is one thing that needs attention.
* @param $result. a query result, any query result that contains an <em>object</em> with the following attributes: $tag->count, $tag->tid, $tag->name and $tag->vid. Refer to tagadelic_get_weighted_tags() for an example."
* @param $steps. The amount of tag-sizes you will be using. If you give "12" you sill get six different "weights". Defaults to 6 and is optional.
* @return An <em>unordered</em> array with tags-objects, containing the attribute $tag->weight;
*/
function tagadelic_build_weighted_tags($result, $steps = 6) {
 
// Find minimum and maximum log-count. By our MatheMagician Steven Wittens aka UnConeD.
 
$tags = array();
 
$min = 1e9;
 
$max = -1e9;
  while (
$tag = db_fetch_object($result)) {
   
$tag->number_of_posts = $tag->count;
   
$tag->count = log($tag->count);
   
$min = min($min, $tag->count);
   
$max = max($max, $tag->count);
   
$tags[$tag->tid] = $tag;
  }
 
// Note: we need to ensure the range is slightly too large to make sure even
  // the largest element is rounded down.
 
$range = max(.01, $max - $min) * 1.0001;

  foreach (
$tags as $key => $value) {
   
$tags[$key]->weight = 1 + floor($steps * ($value->count - $min) / $range);
  }
  return
$tags;
}
?>

Apres, c’est un probleme de math si tu ne comprends pas .. :P

Syndiquer le contenu