PageRenderTime 52ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/documentation/documentation.xml

https://github.com/danielrusciuga/phpld-simple-tagcloud
XML | 315 lines | 270 code | 45 blank | 0 comment | 0 complexity | 5964ad5b2b72267208e50373130930a9 MD5 | raw file
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
  3. <article id="documentation" lang="en">
  4. <?dbhtml filename="documentation.html" ?>
  5. <title>Simple TagCloud for PHP Link Directory</title>
  6. <articleinfo>
  7. <date>02.03.2009</date>
  8. <releaseinfo>1.3 (Bugfix Release)</releaseinfo>
  9. <releaseinfo>This release is a quick bug fix release. Encoding and non-integer weights where addressed, normalization was currently left-out as it produced unexpected output.</releaseinfo>
  10. <abstract>
  11. <para>
  12. Add a <ulink url="http://en.wikipedia.org/wiki/Tag_cloud">Tag Cloud</ulink> to your link directory and join the new web2.0 style.
  13. </para>
  14. </abstract>
  15. <author>
  16. <firstname>Constantin</firstname>
  17. <surname>Bejenaru</surname>
  18. <othername>Boby</othername>
  19. <affiliation>
  20. <address>
  21. <otheraddr><ulink url="http://www.frozenminds.com/">Frozenminds.com</ulink></otheraddr>
  22. <email>constantin_bejenaru@frozenminds.com</email>
  23. </address>
  24. </affiliation>
  25. </author>
  26. <keywordset>
  27. <keyword>tag</keyword>
  28. <keyword>cloud</keyword>
  29. <keyword>php</keyword>
  30. <keyword>web2</keyword>
  31. <keyword>web2.0</keyword>
  32. <keyword>phpld</keyword>
  33. <keyword>PHP Link Directory</keyword>
  34. <keyword>memory</keyword>
  35. <keyword>Frozenminds</keyword>
  36. <keyword>Constantin</keyword>
  37. <keyword>Bejenaru</keyword>
  38. </keywordset>
  39. <copyright>
  40. <year>2006</year>
  41. <year>2007</year>
  42. <year>2008</year>
  43. <year>2009</year>
  44. <holder role="mailto:constantin_bejenaru@frozenminds.com">Constantin Bejenaru</holder>
  45. </copyright>
  46. <legalnotice>
  47. <para>
  48. <ulink url="http://www.gnu.org/copyleft/gpl.html">http://www.gnu.org/copyleft/gpl.html</ulink>
  49. </para>
  50. <para>
  51. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
  52. </para>
  53. <para>
  54. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  55. </para>
  56. <para>
  57. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  58. </para>
  59. </legalnotice>
  60. </articleinfo>
  61. <section id="s1-introduction">
  62. <title>Introduction</title>
  63. <para>
  64. A <ulink url="http://en.wikipedia.org/wiki/Tag_cloud">Tag Cloud</ulink> is a list of tags that are linked to an overview or to the search (like in this case). It gives a visitor a quick overview of what the site or current browsing page is about. Words (=tags) are counted and weighted - the more they occur in the content, the bigger the link is displayed.
  65. </para>
  66. </section>
  67. <section id="s2-installation">
  68. <title>Installation</title>
  69. <para>
  70. This installation of this module is very easy and does not require many coding skills. One file needs to be added to the current <application>PHP Link Directory</application> installation and some code needs to be added to one of the core PHP files and to a template file.
  71. </para>
  72. <section id="s2-1-copy-files">
  73. <title>Add files</title>
  74. <section id="s2-1-1-copy-php">
  75. <title>Copy PHP file</title>
  76. <para>
  77. Copy the <acronym>PHP</acronym> file <filename>tagclouds.php</filename> to the root folder of your <application>PHP Link Directory</application> installation.
  78. </para>
  79. </section>
  80. </section>
  81. <section id="s2-2-edit-files">
  82. <title>Edit your files</title>
  83. <para>
  84. Some files need to be edited in order to have this module available.
  85. </para>
  86. <section id="s2-2-1-edit-init-php">
  87. <title>Edit <filename>index.php</filename></title>
  88. <para>
  89. Edit your <filename>index.php</filename> file and search for following code (at the end):
  90. </para>
  91. <note>
  92. <title>Note</title>
  93. <para>This can be a little different from version to version.</para>
  94. </note>
  95. <screen>
  96. <computeroutput><![CDATA[
  97. //Rewrite Paging links
  98. if (ENABLE_REWRITE == 1)
  99. $tpl->load_filter ('output', 'RewritePageLinks');
  100. //Clean whitespace
  101. $tpl->load_filter ('output', 'trimwhitespace');
  102. //Compress output for faster loading
  103. if (COMPRESS_OUTPUT == 1)
  104. $tpl->load_filter ('output', 'CompressOutput');
  105. //Make output
  106. echo $tpl->fetch ('main.tpl', $id);
  107. ]]></computeroutput>
  108. </screen>
  109. <para>
  110. Right before the above code-block, insert the following:
  111. </para>
  112. <screen>
  113. <userinput><![CDATA[
  114. //Include tagclouds file
  115. require_once 'tagclouds.php';
  116. //Initialize tagclouds class
  117. $tagcloud = new phpld_tagclouds ();
  118. //Add array with categories
  119. $tagcloud->add_categories ($categs);
  120. //Add array with links
  121. $tagcloud->add_links ($links);
  122. //Add array with articles [experimental]
  123. //$tagcloud->add_articles ($articles);
  124. //Define minimum occurrences of a word to be displayed
  125. $tagcloud->mincount (0);
  126. //Define maximum number of allowed tags (most important selected, the rest is removed)
  127. //zero or NULL means infinite
  128. $tagcloud->maxWordsCount (25);
  129. //Define minimum length of word to be displayed
  130. $tagcloud->minwordlength (2);
  131. //Define maximum length of a word to be displayed
  132. $tagcloud->maxwordlength (30);
  133. //Define minimum font size of a tag to be displayed (in procent)
  134. $tagcloud->minfontsize (100);
  135. //Define maximum font size of a tag to be displayed (in procent)
  136. $tagcloud->maxfontsize (300);
  137. //Define maximum nuber for element class (CSS styling)
  138. $tagcloud->styleclass (5);
  139. //Exclude numeric words
  140. $tagcloud->filter_numeric (TRUE);
  141. //Normalize tag cloud
  142. $tagcloud->normalize (FALSE);
  143. //Sort tags (alphabetical, count, random)
  144. $tagcloud->sortmethod ('alphabetical');
  145. //Define Change search URL variable (for phpLD 3.0.4+ = "search", all the rest = "q")
  146. $tagcloud->setsearchvariable ('search');
  147. //Define a title to be displayed above the tagclouds
  148. $tagcloud->title ('<h3>Tag Clouds</h3>');
  149. //Define words to not be displayed (string with words sepparated by comma or space, or an array with one word per key)
  150. $tagcloud->exclude ('as,at,for,from,he,she,it,be,by,to,and,if,it,is,in,or,of,off,about,the,teh,then');
  151. //Assign tagclouds to Smarty template variable "tagclouds"
  152. $tpl->assign ('tagclouds', $tagcloud->get_tagclouds ());
  153. ]]></userinput>
  154. </screen>
  155. <para>
  156. You can play with the above settings to fit your needs.
  157. </para>
  158. </section>
  159. <section id="s2-2-2-edit-footer-tpl">
  160. <title>Edit <filename>footer.tpl</filename></title>
  161. <note>
  162. <title>Note</title>
  163. <para>You can also add this to whatever other template file.</para>
  164. </note>
  165. <para>
  166. Edit <filename>footer.tpl</filename> file located in your current template folder (<filename>/templates/YourTemplate/</filename> for phpLD 3.0.5+ and <filename>/templates/</filename> for all previous versions) and add following code to desired place:
  167. </para>
  168. <screen>
  169. <userinput><![CDATA[
  170. {* Display TagClouds *}
  171. {$tagclouds}
  172. ]]></userinput>
  173. </screen>
  174. </section>
  175. </section>
  176. <section id="s2-3-clean-temp">
  177. <title>Clean compiled template files</title>
  178. <para>
  179. Finally the last step, remove all files located in your <filename>/temp/templates/</filename>.
  180. </para>
  181. </section>
  182. </section>
  183. <section id="s3-customization">
  184. <title>Customization</title>
  185. <para>
  186. The <application>Tag Clouds</application> output can be fully customized by adding CSS properties.
  187. </para>
  188. <section id="s3-1-customize-css">
  189. <title>Customize style</title>
  190. <para>
  191. You can easily change properties for fonts, margins, colors or anything else, by adding <acronym>CSS</acronym> properties.
  192. </para>
  193. <para>
  194. The <application>Tag Clouds</application> box is a DIV with class name <command><![CDATA[tagclouds]]></command>. Style all the rest of the child tags using the parent <command><![CDATA[tagclouds]]></command> class.
  195. </para>
  196. <para>
  197. A simple example is:
  198. </para>
  199. <screen>
  200. <userinput><![CDATA[
  201. .tagclouds { margin: 0 auto; padding: 20px; width: 70%; border: 1px dotted #9EC2F3; }
  202. .tagclouds h3 { font-size: 150%; }
  203. .tagclouds .cloud-word { /* add you general rules for ALL tags */ }
  204. ]]></userinput>
  205. </screen>
  206. <para>
  207. You can also add custom colors and text styling for different tags if you have defined a number for CSS classes:
  208. </para>
  209. <screen>
  210. <userinput><![CDATA[
  211. .cloud-style-1 { color: #0000ff; /*blue*/ }
  212. .cloud-style-2 { color: #000; /*black*/ }
  213. .cloud-style-3 { color: #e98800;/*orange*/ }
  214. .cloud-style-4 { color: #0fb400;/*green*/ }
  215. .cloud-style-5 { color: #ff0000;/*red*/ }
  216. ]]></userinput>
  217. </screen>
  218. </section>
  219. </section>
  220. <section id="s4-project-info">
  221. <title>General Project Information</title>
  222. <itemizedlist>
  223. <listitem><para><emphasis>Title</emphasis>: <application>Tag Clouds for PHP Link Directory</application></para></listitem>
  224. <listitem><para><emphasis>Homepage</emphasis>: <ulink url="http://www.frozenminds.com/phpld-tagclouds.html"><![CDATA[http://www.frozenminds.com/phpld-tagclouds.html]]></ulink></para></listitem>
  225. <listitem><para><emphasis>Demo</emphasis>: not available at this time.</para></listitem>
  226. </itemizedlist>
  227. </section>
  228. <section id="s5-screenshot">
  229. <title>Screenshot</title>
  230. <figure id="screenshot">
  231. <title>Screenshot</title>
  232. <mediaobject>
  233. <imageobject>
  234. <imagedata fileref="images/screenshot.png" format="PNG" />
  235. </imageobject>
  236. </mediaobject>
  237. </figure>
  238. </section>
  239. <section id="s6-license">
  240. <title>License</title>
  241. <para>
  242. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License.
  243. </para>
  244. <section id="s6-license-gpl">
  245. <title>GNU General Public License</title>
  246. <para><trademark class="copyright">Copyright</trademark> 2006-2009 Constantin Bejenaru (http://www.frozenminds.com)</para>
  247. <para>
  248. <ulink url="http://www.gnu.org/copyleft/gpl.html">http://www.gnu.org/copyleft/gpl.html</ulink>
  249. </para>
  250. <para>
  251. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
  252. </para>
  253. <para>
  254. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  255. </para>
  256. <para>
  257. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  258. </para>
  259. </section>
  260. </section>
  261. <section id="s7-powered">
  262. <title>Powered by</title>
  263. <para>
  264. Module, support: <ulink url="http://www.frozenminds.com/">Frozenminds.com</ulink>
  265. </para>
  266. <para>
  267. Documentation: <ulink url="http://www.docbook.org">DocBook</ulink>
  268. </para>
  269. </section>
  270. </article>