Warning: Parameter 3 to mb_videobot() expected to be a reference, value given in /home/wwwjooms/public_html/libraries/joomla/event/dispatcher.php on line 136
How to implement and generate Tag Clouds
How to generate Tag Clouds?
The idea is to automate the process of Tag Cloud generation as soon as user writes a post or content on a page. It can be divided into two steps:
Generate Tag Clouds from the content.
Ideally, we would like PHP code to extract relevant tags (keywords) from the content. We do not want common words like “is”, “this”, “the” to be keywords. We can set up our own set of rules depending on the requirement.
Sample PHP code:
function generateTagCloud($content){ $minTagLength=5; $maxTagLength=14; $baseFont=16; $returnArray=array();
After we have all the tags (keywords) we need to display then according their occurrence or presence in the content. In other words, the tag which is present more times in the content will be displayed in bigger fonts as the rest.
Sample PHP code to achieve this is as follows:
function displayTagCloud($tagCloudArray){ $buffer=""; foreach($tagCloudArray as $tags=>$key) { $font=($baseFont+($key*10)); $font=$font."px"; $buffer.=" $tags "; }$buffer.=""; return $buffer; }