Source for file TagCloud.inc
Documentation is available at TagCloud.inc
require_once $config->get('sysRoot'). 'alpha/util/AlphaErrorHandlers.inc';
require_once $config->get('sysRoot'). 'alpha/util/Logger.inc';
require_once $config->get('sysRoot'). 'alpha/model/TagObject.inc';
* A widget for rendering a tag cloud, based off the TagObject instances in the
* @package alpha::view::widgets
* @author John Collins <dev@alphaframework.org>
* @copyright 2010 John Collins
* @version $Id: TagCloud.inc 1315 2011-03-09 18:09:22Z johnc $
private static $logger = null;
* A hash array of popular tags
private $popTags = array();
* Render the tag cloud and return all of the HTML links in a single paragraph.
* @param $minLinkSize The minimum font size for any tag link, in points.
* @param $maxLinkSize The maximum font size for any tag link, in points.
* @param $target The target attribute for the links
public function render($minLinkSize= 8, $maxLinkSize= 20, $target= '') {
$linkSize = $this->popTags[$key];
if ($linkSize < $minLinkSize)
$linkSize = $minLinkSize;
if ($linkSize > $maxLinkSize)
$linkSize = $maxLinkSize;
$html .= '<a href="'. $config->get('sysURL'). 'search/q/'. $key. '" style="font-size:'. $linkSize. 'pt;"'. (empty($target) ? '' : ' target="'. $target. '"'). ' rel="tag">'. $key. '</a> ';
|