[aha] mashing-up AHA!

da oggi ilsangue at hotmail.com
Tue Oct 14 16:44:54 CEST 2008


non ho tempo per testare, ma onde evitare codice inutilmente ripetuto, io 
farei così:

<html>
    <head>
        <style>
body{
background: #FFFFFF;
color: #000000;
}

div {
background: #DDDDDD;
color: #000000;
margin: 2px;
padding: 5px;
display:block;
float:left;
}
        </style>
    </head>
    <body>
<?php

$testo = file_get_contents("2008-October-compact.txt");
$parts = explode(" ", $testo);
$tags = array();
foreach($parts as $w){
    $w = strtoupper($w);
    if(isset($tags[$w])){
        $tags[$w] = $tags[$w] + 1;
    }else {
        $tags[$w] = 1;
    }
}

asort($tags,SORT_NUMERIC);

$size = 7;
$currval = -1;

while ($el = current($tags)) {
    if( strlen( key( $tags ) )>=3 && strlen( key( $tags ) )<17  &&
!is_numeric( key( $tags ) )  ){
        if($el!=$currval){
            $size++;
            $currval = $el;
        }
    echo "<div style='font: " .  $size. "px
sans-serif;'>" . (key($tags)) .'</div>';
  }
  next($tags);
}
?>
    </body>
</html>


no?


----- Original Message ----- 
From: "xDxD" <xdxd.vs.xdxd at gmail.com>
To: "List on artistic activism and net culture" <aha at ecn.org>
Sent: Tuesday, October 14, 2008 4:30 PM
Subject: Re: [aha] mashing-up AHA!


> gianmarco bonavolontà ha scritto:
>> citandoti:
>> "MERAVIGLIA" :)
>> posso sapere quale tag cloud hai usato??
>>
>
> ho preso il file di testo dei messaggi, holevato i caratteri "strani", 
> l'ho messo tutto su una riga e l'ho frullato con sto codice in fondo al 
> messaggio
> i primi passi si fanno al volo con un paio di comandi in "vi" o in "emacs"
>
> ciaociao!
> xDxD
>
>
> ----
>
>
> <html>
>    <head>
>        <style>
> .body{
> background: #FFFFFF;
> color: #000000;
> }
>        </style>
>    </head>
>    <body>
> <?php
>
> $testo = file_get_contents("2008-October-compact.txt");
> $parts = explode(" ", $testo);
> $tags = array();
> foreach($parts as $w){
>    $w = strtoupper($w);
>    if(isset($tags[$w])){
>        $tags[$w] = $tags[$w] + 1;
>    }else {
>        $tags[$w] = 1;
>    }
> }
>
> asort($tags,SORT_NUMERIC);
>
> $size = 7;
> $currval = -1;
>
> while ($el = current($tags)) {
>    if( strlen( key( $tags ) )>=3 && strlen( key( $tags ) )<17  && 
> !is_numeric( key( $tags ) )  ){
>        if($el!=$currval){
>            $size++;
>            $currval = $el;
>        }
>    echo "<div style='background: #DDDDDD; color: #000000; margin: 
> 2px;padding: 5px; display:block; float:left; font: " .  $size. "px 
> sans-serif;'>" . (key($tags)) .'</div>';
>  }
>  next($tags);
> }
> ?>
>    </body>
> </html>
> _______________________________________________
> Aha mailing list
> Aha at ecn.org
> http://www.ecn.org/mailman/listinfo/aha
> 



More information about the Aha mailing list