Friday, December 4, 2009

Tags in ExpressionEngine

The Tag Module allows you and your users to add Tags to weblog and/or photo gallery entries for ExpressionEngine. It's a very powerful module that allows you to create several different features in your templates using robust functions. You can show Tags that belong to an entry, view all entries that are Tagged with a specified Tag, show related entries based on shared Tags, and build a Tag "Cloud" to show and weigh all Tags in system. Additionally, your members can also subscribe to Tags, and view entries based on Tags they've subscribed to.

If you already have a Tagging system where Tags are placed into a custom field, or if you've manipulated the Tag "feel" by assigning your entries to several EE categories, the Tag module can easily transition your website. Using the built in Harvesting utility, you can easily harvest this data, and it will automatically convert all into Tags and apply them to your entries.

The Tag module adds a clean, robust AJAX tab to your Publish/Edit Entry page in the CP where you can easily add Tags, search for Tags, or scan your custom fields for Tags using the "Suggest" function.

NOTE: Tag requires ExpressionEngine 1.6.x, MySQL 4.1+, and the jQuery for the CP extension.

Following code is for showing tags related for a single entry:-



Tag cloud :-

The Tag:Cloud function creates a "cloud" or list of all Tags in the database, but can be filtered down to specific weblogs, categories, and more. Furthermore, the Tag:Cloud function is able to "weigh" your Tags through different methods, such as how many entries are assigned to them, or how many times they've been clicked.

To help you understand the weighting system, using rank by "entries" that have been assigned that Tag, here is an explanation:

The number of times the highest ranked Tag is used establishes the top of the scale with 0 as the bottom. You can specify the number of groups into which your Tags will be sorted. Each of your Tags will be evaluated as to which group they belong in. They will be given a numerical ranking based on this.

For example, imagine you have 3 Tags on your site; "apple", "orange" and "microsoft". You specify that you want to show a cloud with 3 groups. If "apple" is used 12 times, "orange" 7, and "microsoft" 1, the top of your scale will be 12. "apple" will get the highest rank and the largest font size. "microsoft" will get the smallest ranking and font size. "orange" will get the middle font because it falls into the middle grouping. The range for falling into the lowest group would be 0-4. For the middle, 5-8. And for the top, 9-12. Use following code:-



List of Entries for Each Tag :-