|
Location: Web development - PHP License: The GNU Lesser General Public License How to implement Tag Clouds in PHPPosted by Rochak ChauhanThis is how to implement Tag Clouds in PHP |
Skill: BeginnerPosted: 19/11/2008Views: 745Rating: 3.67 /5Popularity: 1.75 |
| Sign Up to vote for this article |
In technical terms “Tag cloud” can be defined as visual depiction of user-generated tags (words), used typically to describe the content of that page or the website. Not so long ago, we used “meta” tags to describe and define the html page and its contents. In the current time, tag clouds have replaced “meta” tags more than one reason.
The number one reason is SEO (Search engine optimization). Modern day search engines like Google do not bank only on the “Meta” tags to index a web page. They index pages based on its content as well as the links on that page. Apart from SEO, it helps providing a better user experience and each tag (word) is a link to that actual content.
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:
1.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:
2. Display Tags according to their occurrence.
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:
Final output

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License
| Rochak Chauhan
| www.rochakchauhan.com/blog Location: |
Sign up to post message on the article message board!