In the spirit of posting expansions upon your code.caladriJanuary 7 2006, 11:03:36 UTC
Obviously, the div naming is focussed around my current style, which I switched to mainly because it displayed these tags much better than my previous one :)
function TagsPage::print_body { var bool first = true; var int taghicnt = -1; var string[] taghi;
print " "; print "Tags ";
print " " + size($.tags) + " visible tags";
print " "; print " "; foreach var TagDetail td ($.tags) { var string uses = get_plural_phrase($td.use_count, "text_tag_uses"); var string security = $td.visibility; var int tagtextsize = $td.use_count * 5 + 5; if ($tagtextsize > 50) { $tagtextsize = 55; } if ($taghicnt >= 0) { print " "; } if ($td.use_count > $taghicnt) { $taghicnt = $td.use_count; $taghi = []; } if ($td.use_count == $taghicnt) { $taghi[size($taghi)] = $td.name; } if ($td.use_count != 0) { print """ $td.name"""; } } print " if ($
( ... )
the problem is that everything more than my code gets exponentially more compilcated... and not really worth it for now. i have put all the one-shot tags at the bottom, and that cleans it up a little.
Has anyone figured-out a good formula for the tagtextsize? I've only tagged my entries back a couple of months and though it hasn't been purposeful, everything thus far has fit under 54 tags. I really like this idea and have done some experimentation, but even if I reduce the *5+5 to a plain *2, I still end-up with more maximum-sized or huge tags than I'd like. I can't really reclassify things because they wouldn't fit and the plain *2 or a *3 is somewhat acceptable, but I was just wondering if anyone has figured-out another equation.
On a separate note and I'm sure it's mostly because I'm still learning the language, but I'd like to also set a minimum size. I tried adding an "if ($tagtextsize < 7) {$tagtextsize = 7;}" and I've redefined the "px" to be "pt" and though It got everything large enough to be readable; I couldn't see a difference between what should've mathematically been a 9 and the minimum size of 7, when I was experimenting with a multiplier of three
( ... )
On a separate note and I'm sure it's mostly because I'm still learning the language, but I'd like to also set a minimum size. I tried adding an "if ($tagtextsize < 7) {$tagtextsize = 7;}" and I've redefined the "px" to be "pt" and though It got everything large enough to be readable; I couldn't see a difference between what should've mathematically been a 9 and the minimum size of 7, when I was experimenting with a multiplier of three.
I've just been playing with this myself. The minumum text size seems to be defined by the number at the end of the line var int tagtextsize = ($td.use_count * 50) / $most_count + 5;
well I cannot even get past the first step! I went to create a layer and there is no option to choose the mythemehack thing.. can you explain to me?? Thanks so much :)
Comments 28
function TagsPage::print_body
{
var bool first = true;
var int taghicnt = -1;
var string[] taghi;
print "
";
print "Tags
";
print "
" + size($.tags) + " visible tags";
print "
";
print "
";
foreach var TagDetail td ($.tags) {
var string uses = get_plural_phrase($td.use_count, "text_tag_uses");
var string security = $td.visibility;
var int tagtextsize = $td.use_count * 5 + 5;
if ($tagtextsize > 50) {
$tagtextsize = 55;
}
if ($taghicnt >= 0) {
print " ";
}
if ($td.use_count > $taghicnt) {
$taghicnt = $td.use_count;
$taghi = [];
}
if ($td.use_count == $taghicnt) {
$taghi[size($taghi)] = $td.name;
}
if ($td.use_count != 0) {
print """ $td.name""";
}
}
print "
if ($ ( ... )
Reply
(The comment has been removed)
Reply
user-selectable:
smallest font size - 10
biggest font size - 55
found by programming:
least used tag - 2
most used tag - 31
total number of tags - 65
Reply
(The comment has been removed)
On a separate note and I'm sure it's mostly because I'm still learning the language, but I'd like to also set a minimum size. I tried adding an "if ($tagtextsize < 7) {$tagtextsize = 7;}" and I've redefined the "px" to be "pt" and though It got everything large enough to be readable; I couldn't see a difference between what should've mathematically been a 9 and the minimum size of 7, when I was experimenting with a multiplier of three ( ... )
Reply
I've just been playing with this myself. The minumum text size seems to be defined by the number at the end of the line
var int tagtextsize = ($td.use_count * 50) / $most_count + 5;
I upped it to 10 and it's more readable now!
Reply
Reply
Reply
Leave a comment