Home  ›  Template Tags  ›  Tags Template Tags

Tags Template Tags

The following template tags are used to output tags information.

Before using any of these template tags, go to Forum ☛ Configuration ☛ Code and Query Optimisation and turn on the support for ‘Tags’ Template tags

Most Used Tags

This template tag is used to output a list of the most used tags on your forum in a list format.

sf_most_used_tags($limit=10);

Possible arguments to the template tag are:

ParameterDescriptionTypeDefault
$limitHow many tags to show in the list.Integer10

User specified styles available for template tag output is:

StylesAffected Output
li.sftaglistStyles the <li> elements.

An example usage of the template tag is:

<?php sf_most_used_tags(10); ?>

Tag Cloud

This template tag is used to output a list of the most used tags on your forum in a tag cloud format.

With this template tag, you can specify whether the tag cloud is in descending order, ascending order or random order based on the tag count. You can also specify the tags in the cloud are to have varying text size based on its tag count relationship to the other tags displayed. Tags with higher counts will be larger in font size than tags with smaller tag counts. You are able to specify the min and max tag font sizes. You can also specify the tags to have varying text color based on its tag count relationship to other tags displayed. You specify the min tag color and the max tag color. Tags will be colored between those two value depending on its tag count.

sf_tag_cloud($limit=25, $sort='random', $size=true, $smallest=8, $largest=22, $unit='pt', $color=true, $mincolor='#000000', $maxcolor='#cccccc, $sep=' ');

Possible arguments to the template tag are:

ParameterDescriptionTypeDefault
$limitHow many tags to show in the list.Integer25
$sortSort the tags ascending, descending or randomly by tag count.asc, desc or randomrandom
$sizeUse varying text size for tags.Booleantrue
$smallestMin text size (see $unit) for tags.Integer8
$largestMax text size (see $unit) for tags.Integer22
$unitUnits for the varying text size.pt / pxpt
$colorUse varying colors for tags.Booleantrue
$mincolorStarting color for the varying color tags.Hex RGB#000000
$maxcolorEnding color for the varying color tags.Hex RGB#cccccc
$sepseparator between tags.Stringspace

User specified styles available for template tag output is:

StylesAffected Output
a.sftagcloudStyles the <a> elements of the tag cloud.

An example usage of the template tag is:

<?php sf_tag_cloud(10, 'desc', true, 10, 30, 'pt', false); ?>

Related Topics

This template tag is used to output a list of the topics that have similar tags.

sf_related_topics($limit=10, $topic_id, $listtags=true, $forum=true, $echo=true)

Possible arguments to the template tag are:

ParameterDescriptionTypeDefault
$limitHow many topics to show in the list.Integer10
$topic_idThe topic id for which to find related topics.Integer-
$listtagsWrap in <li> tags (li only).Booleantrue
$forumDisplay forum name of related topics.Booleantrue
$echoWrite display (returns it if false).Booleantrue

User specified styles available for template tag output is:

StylesAffected Output
li.sftagliStyles the list elements for each related topic.
p.sftagpStyles the forum name if displayed.

An example usage of the template tag is:

<?php sf_related_topics(10, 45, true, true, false); ?>

Article written by steve on January 24, 2010 and last modified by steve on May 29, 2010