Содержание

Cloud Plugin

Compatible with DokuWiki

>= 2006-11-06

plugin Show a cloud of the most frequently used words in your wiki (previous authors: Esther Brunner)

Last updated on
2011-03-07
Provides
Syntax
Repository
Source
Requires
pagelist, searchstats, tag

Similar to cumulus

Tagged with listing, navigation, search, tags

Download plugin-cloud.tgz

Description

This is a very simple plugin that shows a cloud of the most frequently used words in your wiki:

~~CLOUD~~
~~CLOUD:number~~

Optionally you can specify the number of words to display. Default is 50. Allowed are numbers between 1 and 999. Each of the words is linked to the search result page for it. The words are styled in a way that more frequent words are bigger and have a darker link color.

You can exclude words from the word cloud by adding them each on its own line to inc/lang/[lang-code]/stopwords.txt or to conf/stopwords.txt. Remember that last line in file should be empty to work correctly.

This plugin can also make a “tag cloud” now! (tag plugin must be installed) The syntax is also simple:

~~TAGCLOUD~~
~~TAGCLOUD:number~~
~~TAGCLOUD:number>namespace1:subns11|.|namespace2~~

I also supports clouds for the most searched words in the wiki (searchstats plugin must be installed):

~~SEARCHCLOUD~~
~~SEARCHCLOUD:number~~

Development

Changes

Bugs/Feature Requests

Please report bugs and feature requests at the Bug Tracker.

Demo

http://chimeric.de/_demo/plugin:cloudFIXME

FAQ

Caching for clouds

Hi, is it possible to cache the cloud? If i activate the plugin on my page, it slows down my system very much.

You can enable the caching feature by setting $renderer→info['cache'] = false; in syntax.php line 82 to true.

Whitespaces in Tags

Use underscores to specify whitespaces in tags.

Cloud in Windows-Server

You run cloud on a Windows server. The stylesheet style.css must be edited to hold Windows linebreaks rather then Unix. This solved the same problem for me. Ruud

More than one Cloud on a page

When you have more than one cloud (eg. a word and a tag cloud) on a page you end up with invalid HTML because each cloud has the same id (<div id=“cloud”>…), id's must be unique within a page.

Discussion

The old discussion has been moved to discussion_old and will be cleaned up sooner or later. Please add bug reports and feature requests to the bug tracker of the plugin!

Related to the previous suggestion for tagcloud; If the first heading exists in a page of the specified tag, I'd like the tag-clouds to appear the first heading of the tag page.

I have one problem that the size of each tag remain the same, does not change. I am using a sandy.

SEARCHCLOUD Size

When a searchcloud is rendered, the size of each search term remains the same (cloud5). Kludgy fix:

After

     $cloud = $helper->getSearchWordArray($num);

Add

     ksort($cloud); // optional, changes sort from hit count to alphabetical
     if ($num != 50) { // if not the default cloud size
       $min=1;         // set the minimum to 1 to ease the tiny text problem
     } else {
       $min=true;
     }
     $max=true;
     foreach ($cloud as $word => $size) {
       $min = min($size,$min);
       $max = max($size,$max);
     }

Stopwords in tag clouds?

I was trying to remove some tags from the tag cloud as I have nested tags as a structuring element but due to this, certain tags appear much more often than others (the 'folder' tags). However, the described methods (include stopwords.txt in conf/ or inc/lang/) apparently do not work for tag clouds. Is there some way to have the clouds behave the way I would like them to? — CantelloCantello

Lüneburg, Germany
2011/11/30 19:40

patch to fix stopwords

@CantelloCantello

Lüneburg, Germany
— I've attached a simple one-liner patch that helped me fix the same problem. It turns out that there's a single space that's not trimmed from the $stopwords array in the syntax.php file… hence array_search($key, $stopwords) never returns True.
— skipliquid # skipliquid # at # g # mail # dot # com
2012/1/31 14:00

cloud_stopwords-fix.diff
--- syntax.php.orig     2012-01-31 14:24:50.000000000 -0500
+++ syntax.php  2012-01-31 14:47:57.849347682 -0500
@@ -142,6 +142,7 @@
         $swfile = DOKU_CONF.'stopwords.txt';
         if (@file_exists($swfile)) $stopwords = array_merge($stopwords, file($swfile));
 
+       $stopwords = array_filter(array_map('trim', $stopwords));
         $cloud = array();
 
         if (@file_exists($conf['indexdir'].'/page.idx')) { // new word-length based index