Tools und Service Übersicht
#!/usr/bin/perl ############################################### # tagcloud.cgi (c) <hsulzer@t-online.de> 2007 # ############################################### # use CGI::Carp qw(fatalsToBrowser); use CGI qw/:standard/; use DBI; ################ $SQL = "SELECT tag FROM DATENBANKTABELLE"; &connect_to_db; &db_exec_query; while( @row = $sth->fetchrow_array ) { @row[0] = lc(@row[0]); push(@tags,@row[0]); $counter++; } $dbh->disconnect; ################ $i = 0; $more = 1; #ANPASSUNG AN GESAMTZAHL FEHLT HIER NOCH $points = 7; #CSS-ANGABE STARTGROESSE print "Content-type: text/html\n\n"; print "Darstellung der Begriffe die mehr als $more mal (Minimum dynamisiert) vorkommen (Anzahl in Klammern):\n"; @tags = sort(@tags); #ALPHABETISCHE SORTIERUNG foreach $tag(@tags) { $tag = lc($tag); if($tag eq @tags[$i+1]) { $points = eval($points + 2); #CSS-ANGABE, STEIGERUNG DER SCHRIFTGROESSE $more++; } else { if($more > 1) { print "<a href=\"../$tag\" title=\"$tag\" style=\"font-size:$points\pt\">$tag\</a> ($more) \n"; $more = 1; $points = 7; } } $i++; } exit(0); ########################### sub connect_to_db ########################### { $DSN = "DBI:mysql:DATENBANK:DATENBANKSERVER:DATENBANKSERVERPORT;mysql_connect_timeout=3"; $user = "USER"; $pw = "PASSWORT"; $dbh = DBI->connect($DSN,$user,$pw)|| die "can't connect: $DBI::errstr\n"; return; } # end sub connect_to_db ########################### sub db_exec_query ########################### { $sth = $dbh->prepare($SQL); $sth->execute; return ($sth); } # end sub db_exec_query #### endall ################## # source tagcloud.html: # <!--#exec cgi="cgi-bin/tagcloud.cgi"-->