Kevin
Well-known member
That's what I've been trying to tell you all along.PS: of course, there might be exceptional cases. E.g. all your top 25 tags have only 1 or 2 uses, then the sizes of top 10 and top 25 might be the same
That's what I've been trying to tell you all along.PS: of course, there might be exceptional cases. E.g. all your top 25 tags have only 1 or 2 uses, then the sizes of top 10 and top 25 might be the same
Ok, sorry. My badThat's what I've been trying to tell you all along.
<?php
class Eagle_MostPopularTags_Model_MostPopularTags extends Xenforo_Model_User
{
public static function MostPopularTagsArray()
{
$db = XenForo_Application::get('db');
$MostPopularTags = array();
$options = XenForo_Application::get('options');
$limitforpopulartags = XenForo_Application::get('options')->MostPopularTagsCount;
$levels = 7; // How many CSS weights are defined?
$cacheId = 'Eagle_MostPopularTags';
if (XenForo_Application::get('options')->MostPopularTagsEnableAddon)
{
// Are there any results in the cache?
if($cacheObject = XenForo_Application::getCache())
{
if($MostPopularTags = $cacheObject->load($cacheId))
{
return $MostPopularTags;
}
}
$MostPopularTagsArray = $db->fetchAll($db->limit("
SELECT tag, tag_id, tag_url, use_count
FROM xf_tag as tag
WHERE tag_id
ORDER BY use_count DESC", $limitforpopulartags)
);
// Sort the results
sort($MostPopularTagsArray);
// Get the highest use count so we can give tag weights within the results
$uses = XenForo_Application::arrayColumn($MostPopularTagsArray, 'use_count');
$max = max($uses);
foreach($MostPopularTagsArray as $tag)
{
$hrefx = XenForo_Link::buildPublicLink('tags', $tag);
$tag['use_count'] = floor(($tag['use_count'] * 100) / floor(($max * 100) / $levels));
$MostPopularTags[] = array("tags" => $tag['use_count'], "tag_url" => $tag['tag_url'], "title" => $tag['tag'], "href" => $hrefx);
}
// Save the results to the cache
if($cacheObject = XenForo_Application::getCache())
{
$cacheObject->save($MostPopularTags, $cacheId, array(), 3600);
}
return $MostPopularTags;
}
}
}
Nope and I don't have a plan for xenPorta2, because I don't get this add-on yet. Maybe, the next time.
jQuery Effect
Unless you only have 25 tags total on your site then the tag weights are likely correct. The weights are within the 25 tags being shown in the widget subset, not within all of the tags including the ones not being shown. That is unlike the tag search page where it shows all of your tags and the weights are based on all tags, not just a subset.Unfortunately, with the latest upgrade I still have the wrong interpretation of tag classes. For example, in the XF tag search tags are displayed as ".tagCloudTag1" but they are shown in the Most Popular Tags widget as ".tagCloudTag3".
Did you find the issue?@Eagle
Thanks for this add-on.
Forum down after installing your add-on.
Error message => Zend_Db_Statement_Mysqli_Exception: Mysqli prepare error: Table 'betclever_prod.xf_tag' doesn't exist - library/Zend/Db/Statement/Mysqli.php:77
Xenforo version => 1.44 (Need to upgrade, I know but I'm using a custom theme and waiting the developper).
We use essential cookies to make this site work, and optional cookies to enhance your experience.