Tagadelic et tagadelic.level1

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 ...


aviso
Posts: 49
Joined: 2008-03-12

Personne ne peux m'éclairer ?



Haza
Portrait de Haza
Posts: 206
Joined: 2007-09-11

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 <a href="mailto:ber@webschuur.com" rel="nofollow">ber@webschuur.com</a>. 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

--

Web-42 : Tribulations Drupaliennes sans fondements