8317 (ingmars87)

Nezinu, visticamāk tev.. 

pirmdien, 11.12.2006 @7:08 pm | 8317

Nezinu, visticamāk tev nederēs, bet manam flexible squares ir šitāds mākoņa kōds:

function print_sidebar()

{

####   TAG CLOUD CODE   ####



###### Configuration ######



var int tag_category = 8; # The number can be changed if you want more or fewer categories.

var int basefontsize = 80; # size of the first tag category in percent of the default font size of the page

var int increment = 20; # The difference in size between tag categories.

var string tag_title = "Tēmas"; # Title of the tag box.



###### End Configuration ######



var Page p = get_page();

var string list = "";

var int max_use_count = 0 ;

var int min_use_count ;

var int x ;

    

if (size $p->visible_tag_list() > 0)

{



# Define a maximum and minimum number of uses of the tags:

var TagDetail[] visible_tag_list = $p->visible_tag_list();

if($visible_tag_list)

{

     $min_use_count = $visible_tag_list[0].use_count;

     foreach var TagDetail td ($p->visible_tag_list())

     {

     if ($td.use_count > $max_use_count)

     {

     $max_use_count = $td.use_count;

     }

     elseif ($td.use_count < $min_use_count)

     {

     $min_use_count = $td.use_count;

     }

    

}

}



# Avoid a division by zero

if ($max_use_count == $min_use_count)

{

$max_use_count = $max_use_count + 1;

}



# Put the tags into categories according to the number of times they're used,

# then use it to determine the size of the tag:

foreach var TagDetail td ($p->visible_tag_list())

{

# Create different categories according to the number of uses of the tag

$x = (($td.use_count - $min_use_count) * $tag_category / ($max_use_count - $min_use_count));

if ($x == $tag_category) { $x = $tag_category - 1; }



# Convert those categories into sizes

$x = ($x * $increment) + $basefontsize;

$list = $list + """<a href="$td.url" title="$td.use_count" style="font-size: $x%">$td.name</a> """;

}



# Enclose the entire list in an li tag as required by the layout.

$list = """<li class="tagBox">""" + $list + """</li>""";



# Add styling to box title.

$tag_title = """<li class="sbartitle">$tag_title</li>""";

}

####   END TAG CLOUD CODE   ####

(Ņem vērā, ka parasti neviens neizvēlas atbildēt uz pilnīgi anonīmiem komentāriem!)

No:
Lietotājvārds:
Parole:
(komentārs tiks paslēpts)
Ievadi te 'qws' (liidzeklis pret spambotiem):
Temats:
Tematā HTML ir aizliegts
  
Ziņa:

Gandrīz jau aizmirsu pateikt – šis lietotājs ir ieslēdzis IP adrešu noglabāšanu. Operatore Nr. 65.