As you probably noticed, the tags function does not work like a typical search function so implementing this was not trivial. But it is a great idea and with a little thought I was able to take a stab at it. Here's the rewritten tags function allowing you to use a when parameter.
function BOLTFtags($args) { global $BOLTinfoCache; $page = BOLTinit('index.tags', $args[1], $args['page']); if (in_array('cloud', $args)) { global $pageLink; deprecate('tag_cloud', 'The tags function now requires fmt=cloud', $pageLink); if ($page == 'cloud') $page = 'index.tags'; $args['fmt'] = 'cloud'; } BOLTinfoVar($page); $tagArray = $BOLTinfoCache[$page]; $tagPages = array_keys($tagArray); foreach ($tagPages as $i => $p) { if ($args['when'] != '') { $when = BOLTdisplayReplace($args['when'], $i, $tagPages, Array('info'=>$page)); if (BOLTiftrue($when, 'true') != 'true') { unset($tagArray[$p]); continue; } } $tags .= ' ' . $tagArray[$p][0]; } if (trim($tags) == '') return BOLTinit('No tags found...', $args['none']); $tags = explode(' ', trim($tags)); foreach ($tags as $t) { $tag[$t] = $tag[$t] + 1; } if (is_number($args['count'])) { krsort($tag); $tag = array_slice($tag, 0, $args['count']); } if ($args['sort'] != 'false') ksort($tag); if ($args['fmt'] == 'cloud') { $c = $tag; sort($c); $low = $c[0]; $high = $c[count($c)-1]; $diff = ($high - $low); $max = BOLTinit(17, $args['max']); $min = BOLTinit(10, $args['min']); ksort($tag); foreach($tag as $i => $ii) { $x = ((($ii - $low) / $diff) * $max) + $min; // 12 is smallest size, 12 + 15 is largest size. px $out .= " <span style=\"font-size: " . $x . "px;\">[[action.tags&tag=$i|$i]]</span> "; } return $out; } if ($args['fmt'] == '' && $args['template'] == '') $args['fmt'] = '[[action.tags&tag={+field}|{+field}]]'; return BOLTdisplay ($tag, $args); } I'm also going to change a bit how the parameters work. Now to get a tagcloud, you do fmt=cloud. The current behavior will continue for awhile, but has been deprecated. The reason is you could conceivably have a page called cloud. Please double check my code and make sure it works for you. Preliminary testing looks good. Cheers, Dan On Sun, Jan 17, 2016 at 2:40 AM Tiffany Grenier <grenier.tiff...@gmail.com> wrote: > Hi, > > The listtags function mainly has one different line from the tags > function, the one with the comment. It only reads the tags for the current > (or given) page group, so the return cloud would only be for the current > (or given) page and its descendants. > As far as I can tell, if you put [(tags cloud)] on page "docs", then any > tags in the forum area (for example in forum.1001) will be taken into > account. With the listtags function, you could be able to do [(listtags > cloud=docs)] for the tagcloud of the docs area and [(listtags could=forum)] > for the forum area. > Creating an index for each site area that might be worth a tagcloud is, to > my mind, unnecessary work. But I did not want to alter the tags function > while degrading its feature. > > I was also thinking that it would be nice if the "tags" function accepted > a "when" parameter like search and list (and later query) since it is also > dealing with indexes. In such a case, my listtags function would not be > needed anymore as one could do [(tags cloud when=' {+p} equal site.area || > insource string={+p} find="site.area." ')]. My interest in here would be to > do [(tags cloud when='gamedate {+p} || visiblegamepost {+p}')] without > having to rebuild a different index. > > Cheers, > Tiffany > > -- > You received this message because you are subscribed to the Google Groups > "BoltWire" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to boltwire+unsubscr...@googlegroups.com. > To post to this group, send email to boltwire@googlegroups.com. > Visit this group at https://groups.google.com/group/boltwire. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "BoltWire" group. To unsubscribe from this group and stop receiving emails from it, send an email to boltwire+unsubscr...@googlegroups.com. To post to this group, send email to boltwire@googlegroups.com. Visit this group at https://groups.google.com/group/boltwire. For more options, visit https://groups.google.com/d/optout.