DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:cloud

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:cloud [2017-08-05 19:15] – Added showCount option LarsDW223plugin:cloud [2024-03-07 19:30] (current) – Tested OK with Kaos dregad
Line 2: Line 2:
  
 ---- plugin ---- ---- plugin ----
-description: Show a cloud  of the most frequently used words in your wiki+description: Shows word cloud from different sources (used words, tags, searched words)
 author     : Dokufreaks (previous authors: Michael Hamann, Gina Häußge, Michael Klier, Esther Brunner) author     : Dokufreaks (previous authors: Michael Hamann, Gina Häußge, Michael Klier, Esther Brunner)
 email      : freaks@dokuwiki.org email      : freaks@dokuwiki.org
 type       : syntax type       : syntax
-lastupdate : 2017-08-05 +lastupdate : 2023-02-11 
-compatible : Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons, Hrun, Detritus+compatible : Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons, Hrun, Detritus, Frusterick Manners, Greebo, Hogfather, Igor, Jack Jackrum, Kaos+
 depends    : pagelist, (tag), (searchstats) depends    : pagelist, (tag), (searchstats)
 conflicts  conflicts 
Line 13: Line 13:
 tags       : navigation, listing, tags, search tags       : navigation, listing, tags, search
  
-downloadurl: https://github.com/dokufreaks/plugin-cloud/zipball/master+downloadurl: https://github.com/dokufreaks/plugin-cloud/archive/master.zip
 sourcerepo : https://github.com/dokufreaks/plugin-cloud/tree/master sourcerepo : https://github.com/dokufreaks/plugin-cloud/tree/master
 bugtracker : https://github.com/dokufreaks/plugin-cloud/issues bugtracker : https://github.com/dokufreaks/plugin-cloud/issues
 ---- ----
- 
-^ Download | [[https://github.com/dokufreaks/plugin-cloud/tarball/master|plugin-cloud.tgz]] | 
  
 ===== Description ===== ===== Description =====
 +==== Word cloud ====
  
-This is a very simple [[plugins|plugin]] that shows a cloud of the most frequently used words in your wiki:+This is a very simple plugin that shows a cloud of the most frequently used words in your wiki:
  
   ~~CLOUD~~   ~~CLOUD~~
   ~~CLOUD:number~~   ~~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.+Optionally you can specify the number of words to display. Default is 50. 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! ([[plugin:tag]] plugin must be installed) The syntax is also simple:+==== Tag cloud ==== 
 + 
 +This plugin can also make a "tag cloud"([[plugin:tag]] plugin must be installed.) The syntax is:
  
   ~~TAGCLOUD~~   ~~TAGCLOUD~~
   ~~TAGCLOUD:number~~   ~~TAGCLOUD:number~~
   ~~TAGCLOUD:number>namespace1:subns11|.|namespace2~~   ~~TAGCLOUD:number>namespace1:subns11|.|namespace2~~
 +
 +==== Search word cloud ====
  
 It also supports clouds for the most searched words in the wiki ([[plugin:searchstats]] plugin must be installed): It also supports clouds for the most searched words in the wiki ([[plugin:searchstats]] plugin must be installed):
Line 42: Line 44:
   ~~SEARCHCLOUD:number~~   ~~SEARCHCLOUD:number~~
  
-Since release 2017-08-05 the number of occurrences can also be output by adding the ''showCount'' option like this:+===== Options ===== 
 +''[showcount]'' the number of occurrences can also be output by adding the ''showCount'' option.
  
-  ~~CLOUD[showCount]~~+'':number'' sets the number of items shown in the cloud. Default 50, minimal 1 and maximum 999. 
 + 
 +''>namespace1|namespace2'' (//tag cloud only//) filters the tags in the tag cloud to these belonging to given namespace(s), with ''|'' you can add more namespaces. 
 + 
 +All options together applied: 
 +  ~~TAGCLOUD[showCount]:10>yournamespace~~ 
 + 
 + 
 +===== Configuration ===== 
 + 
 +The plugin can be configured with the DokuWiki Configuration manager available in the admin menu. 
 + 
 +^ ''minimum_word_length'' | Minimum word-length for words in the cloud. Default: 2 | 
 +^ ''word_blacklist'' | Words, which shouldn't be displayed on pages (Comma separated) | 
 +^ ''tag_blacklist'' | Tags, which shouldn't be displayed on pages (Comma separated) | 
 +^ ''search_blacklist'' | Search words, which shouldn't be displayed on pages (Comma separated) | 
 +^ ''list_tags_of_subns'' | List also tags in subnamespaces of a specified namespace | 
 + 
 +You can exclude words from the word cloud by adding them to the ''word_blacklist'' configuration setting. Alternatively, words can be added 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 affects also the fulltext indexing. 
 + 
 + 
 +==== Modifying the style ==== 
 +The CSS style of the cloud is defined in ''style.less''. The less code makes it easier to modify the look of the cloud. In ''[[https://www.dokuwiki.org/devel:css#user_styles|conf/userstyle.less]]'' you can just override the variables used.  
 + 
 +To modify the text size in the cloud only the size factor ''@sF'' needs to be changed. The following example doubles the size by changing the size factor from 1 to 2. 
 + 
 +To change the color modify one of the three base color values in ''@c0'', ''@c1'' or ''@c2''. The following code will make the cloud have a lime green base color. 
 + 
 +<code css conf/userstyle.less> 
 +/* Size factor */ 
 +@sF: 2; 
 +/* Lime green base color for the word cloud */ 
 +@c0: #32CD32; 
 +</code> 
 + 
 +Please only use RGB color values here, not CSS color names.
  
 ===== Development ====== ===== Development ======
  
 ==== Changes ==== ==== Changes ====
- 
-  * **2013-02-27**: 
-    * Fixed stopwords. Note that stopwords are only for the word cloud and not for the tag or searchstats cloud. 
-    * Added different text sizes for the searchstats cloud 
-    * Changed HTML output to be valid when more than one cloud is used on a page, if you had adapted the colors/styling of the tag cloud you need to adapt your CSS (the ''cloud'' id was changed into a class). 
  
 Most recent code changes: Most recent code changes:
Line 68: Line 101:
 Site using this plugin Site using this plugin
  
-  * [[http://wiki.zebras-crossing.org]] (it is a TAGCLOUG modified with the CLOUD colors)+  * [[http://wiki.zebras-crossing.org]] (it is a TAGCLOUD modified with the CLOUD colors)
  
 ===== FAQ ===== ===== FAQ =====
Line 76: Line 109:
 Hi, is it possible to cache the cloud? If i activate the plugin on my page, it slows down my system very much. 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 74 to //true//.+You can enable the caching feature by setting ''%%$renderer->info['cache'] = false;%%'' in syntax.php line 74 to ''true''
 +>> Note that with caching also ACL protected pages can be listed unintended. So be aware of how ACL are used before enabling caching.
  
 ==== Whitespaces in Tags ==== ==== Whitespaces in Tags ====
Line 86: Line 120:
 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// 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. 
-> Fixed int he 2013-02-27 version  --- [[user>Michitux|Michael Hamann]] //2013/02/27 23:50// 
  
 ===== Discussion ===== ===== Discussion =====
  
 The old discussion has been moved to [[plugin:cloud:discussion_old]] and will be cleaned up sooner or later. Please add bug reports and feature requests to the bug tracker of the plugin! The old discussion has been moved to [[plugin:cloud:discussion_old]] and will be cleaned up sooner or later. Please add bug reports and feature requests to the bug tracker of the plugin!
 +
 +==== First heading in tagcloud ====
  
 >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. >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 [[template:sandy]].  
- 
-==== SEARCHCLOUD Size ==== 
- 
-When a searchcloud is rendered, the size of each search term remains the same (cloud5). Kludgy fix: 
- 
-After 
-<code> 
-     $cloud = $helper->getSearchWordArray($num); 
-</code> 
-Add 
-<code> 
-     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); 
-     } 
-</code> 
- 
-> (Different) fix is in the 2013-02-27 version  --- [[user>Michitux|Michael Hamann]] //2013/02/27 23:50// 
  
 ==== Stopwords in tag clouds? ==== ==== Stopwords in tag clouds? ====
Line 129: Line 135:
 > stopwords are only for the word cloud, not for the tag cloud. I consider adding a similar (but differently named) blacklist for the tag cloud.  --- [[user>Michitux|Michael Hamann]] //2013/02/27 23:50// > stopwords are only for the word cloud, not for the tag cloud. I consider adding a similar (but differently named) blacklist for the tag cloud.  --- [[user>Michitux|Michael Hamann]] //2013/02/27 23:50//
  
-=== patch to fix stopwords === 
- 
-@[[user>Cantello|Cantello]] --- 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// 
- 
-<code php 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 
-</code> 
- 
-Thanks @ skipliquid! 
-Where do I have to implement that code or the file? 
-Best regards, flu. 
- 
-> A different fix for this problem is in the 2013-02-27 version.  --- [[user>Michitux|Michael Hamann]] //2013/02/27 23:50// 
  
 ==== Tagcloud links to pages ==== ==== Tagcloud links to pages ====
Line 181: Line 165:
  
 >> I would also like to see this functionality. It would be excellent if (just as in the SEARCHCLOUD syntax) a cloud could be generated from the resullts of a TagFilter plugin listing.--- [[user>JD4x4|JD4x4]] >> I would also like to see this functionality. It would be excellent if (just as in the SEARCHCLOUD syntax) a cloud could be generated from the resullts of a TagFilter plugin listing.--- [[user>JD4x4|JD4x4]]
-==== Show the number of occurences for each tag ==== 
- 
-Could you please tell me how can i show the number of occurences of each tag of the cloud, such as keyword(number)..\\  
- 
-Thank u 
  
-//Steve 19/08/2013// 
  
  
  
  
plugin/cloud.1501953358.txt.gz · Last modified: 2017-08-05 19:15 by LarsDW223

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki