-
Website
http://hitormiss.org/ -
Original page
http://hitormiss.org/projects/weighted-categories/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
Thorsten Zoerner
1 comment · 4 points
-
-
Popular Threads
I don't want to use the categories-list, I want to show the list by keywords like you have on your site. Is it something that can be a simply changed in the code I insert in the page.
Or maybe is going to be a another plugin? Let me know! I must apologize for my bad english, have a nice day.
//Örjan
(thinking of this code)
lo instalé y funciona a la perfección
the link for the latest categoriy listet is not correct :|
$cats = explode("\n", $cats);
array_pop($cats); // this line !
foreach ($cats as $cat)
can you be more specific about how to use this script?
Thanks
i don't know why is not working here: http://wearemad.weblogs.us/livearchives/
in the category space, it wrongs add the link... eny idea!? :(
I've been using this little plugin for quite a while and have never had a problem with it under 1.5. However, I've just added a new category and it won't display. Instead of using the standard http://www.ektopia.co.uk/ektopia/archives/categ... URL it shows http://www.ektopia.co.uk/ektopia/weighted-categ... but ONLY for that particular category and therefore points to a 404.
Any idea what might be going on?? Cheers
I have corrected the code. Now it works fine for me:
The only thing I had to do actually was to adjust tag font size to make the whole thing fit my sidebar. Check it out http://rodolphoarruda.pro.br/blog/
My test WP install is at http://tin-men.net/wordpress
Cheers!
/* Sort on counts */
arsort( $counts );
/* Only keep top $number */
$i=count( $counts )-$number;
for($j=1;$j
for($j=1;$j
/* Sort on counts */
arsort( $counts );
/* Only keep top $number */
$i=count( $counts )-$number;
for($j=1;$j&=$i;$j++)
{
array_pop( $counts );
}
/* Sort alphabeticly again (case insensitive) */
uksort($counts, "strnatcasecmp");
I've played around with your plug-in and added some features :
- Display the categories with different opacities (more posts = less transparents) and you can define a minimum opacity
- Display the categories with different colors
For the latter, you specify 2 colors (in #xxxxxx or #xxx format), the first will determine the color of your category that has less posts will have and the second will determine the color of your category that has more posts. You also specify the number of color your palette will have.
Okay, so I know my english sucks (especially at 4 a.m.) but go check my website @ http://www.autre-chose.org
I'll clean the code in a few days and will make the plugin available for download.
Nice plugin which finished off my website nicely http://www.diretribe.com however, there are a couple of bugs in the maths that thought I should let you know about.
When calculating the spread/step values the variables are the wrong way around, the correct ways should be as follows:
$mincount=min($counts);
$spread = max($counts) - min($counts);
if ($spread
Note, you need the $mincount for later when outputting as followed:
($smallest + ($fontstep * ($count-$mincount)))
By doing it this way the values of the font-sizes will always fall withn your range set in min/max (before that it didn't seem to).
An example:
font_spread: 10-20
count_spread: 1-3
count_min: 1
font_step = font_spread/count_spread = 10/2 = 5
e.g. where count = 2
5*(count-count_min)+minimum_font = 5*(2-1)+10 = 15
Compared to:
font_step=count_spread/font_spread = 2/10 = 0.2
e.g. where count=2
minimum_font+(count/font_step)=10+(2/0.2)=10=20
As you can see in the second example (using the current maths in the plugin) a half-way value is hitting the maximum. Hope that helps - if you need any help let me know.
Folowing Maxime Dupuis example above I've also knocked it into providing transparency & so on. Lovely. Thanks again for a great plugin.
I have been many days going on weeks scouring this internet thru Google and all i ever find are people posting comments on nothing but one error after another, and i have personally downloaded many of these only to have them show nothing but errors myself and also never do any of you coders ever draw up step for step instructions.
Change:
$cats = list_cats(1, 'all', 'name', 'asc', '', 0, 0, 1, 1, 0, 1, 1, 0, 1, '', '', $exclude, 0);
to
$cats = trim(list_cats(1, 'all', 'name', 'asc', '', 0, 0, 1, 1, 0, 1, 1, 0, 1, '', '', $exclude, 0));
... and all will be well.
function weighted_categories($smallest=10, $largest=48, $unit="pt", $exclude='') {
$all_cats = trim(list_cats(1, 'all', 'name', 'asc', '', 0, 0, 1, 1, 0, 1, 1, 0, 1, '', '', $exclude, 0));
foreach (explode("\n", $all_cats) as $cat) {
preg_match('{a href="([^"]+)".+?>(.*) ?\((\d+)\)}', $cat, $matches);
list(,$url, $name, $count) = $matches;
printf('%s'."\n", $url, $count, abs($count) != 1 ? 'entries' : 'entry', $count, $name);
$counts[$count] = 1;
}
$counts = array_keys($counts);
$step = (max($counts) - min($counts)) / ($largest - $smallest);
echo '';
foreach($counts as $count){
echo ".tcloud-$count {font-size: " . ($smallest + ($step * $count)) . $unit . " }\n";
}
echo '';
}
http://www.the-tempest.net
Thanks nonetheless!
Beyond that, this is a really great plug-in. Simple, fast, and effective - exactly what I was looking for.
You wrote:
"In the file where you want to display the weighted list of categories (ex. archives.php), insert the following code:
"
But it that doesn't works in my blog.
I've changed
to -->
So I add the letters "php" between
I added it to the sidebar.php file for the fasttrack theme because that theme doesn't use archive.php
Good job.
someone pls help me!!11`~~!!!
Warning: Cannot modify header information - headers already sent by
pls help me
-less than- -question mark-
to
-less than- -question mark- -php-
with no spaces!
btw, where which CSS did you alter? the style.css?
Any way you can port this to Wordpress 2.1 that was released a few hours ago?
I'm looking forward for this...
I wrote an updated version that works for wordpress 2.1.
It hase some new features and better wordpress integration (i.e. option page), it's called Category Cloud :)
In any case - thanks for sharing!
SF