This function ranks and displays all tags that have been subscribed to in order of most subscribed to. It also allows you to order them in various other ways as well.
{exp:tag:subscriptions_rank} content {/exp:tag:subscriptions_rank}
Parameters
The following parameters available for use:
member_id=
member_id="not 3|7"
This parameter allows you to specify or exclude members from the results. Typically, you would use this parameter for excluding some members.
orderby=
orderby="subscription_rank"
This parameter allows you to order your tags by the method you wish. Available methods are: subscription_rank, total_entries, tag_name, and random. Default method is tag_name.
sort=
sort="asc"
This parameter allows you to sort tags by ascending (asc) or descending (desc) order.
tag=
tag="not pants|mitchell"
This parameter allows you to specify tags to include or exclude. Typically, you would use this parameter to exclude some tags.
tag_id=
tag_id="25"
This parameter allows you to specify tag ID's to include or exclude. Typically, you would use this parameter to exclude some tags.
limit=
limit="10"
You can limit the number of tags returned by using this parameter.
websafe_separator=
websafe_separator="-"
This parameter allows you to control the websafe separator character for multi-word tags generated by the websafe_tag variable. Allowable characters are +, -, and _. The default is +. Be sure to use this parameter consistently throughout your site if you change from the default value of +. For example, if you're linking to your Tag:Entries page with - as your websafe separator, you'll need to add this same parameter with - as the value for your Tag:Entries page. Otherwise results will not show correctly.
Variables
The following variables are available for use:
- absolute_count
- clicks
- count
- subscribe_link
- unsubscribe_link
- subscription_rank
- tag
- total_entries
- total_results
- websafe_tag
absolute_count
{absolute_count}
This variable will return the absolute count of the order of the displayed results. This differs from the count variable because with pagination, the "rank position" number will stay as it should.
clicks
{clicks}
This variable will return the number of times each tag has been "clicked" (viewed in Tag:Entries loop).
count
{count}
This variable will return the total number of instances of each tag across channel entries, within the specified parameters. For example, specifying the status parameter would affect the count on this variable.
subscribe_link
{subscribe_link}
This variable generates a URL for subscribing to a tag. You can additionally add &return= to the URL to control the return path after the confirmation message page. An example could look like this:
<a href="{subscribe_link}&return=template_group/template">Subscribe</a>
unsubscribe_link
{unsubscribe_link}
This variable generates a URL for unsubscribing from a tag. You can additionally add &return= to the URL to control the return path after the confirmation message page. An example could look like this:
<a href="{unsubscribe_link}&return=template_group/template">Unsubscribe</a>
subscription_rank
{subscription_rank}
This variable displays the number of subscriptions to a given tag.
tag
{tag}
This variable returns the tag name.
total_entries
{total_entries}
This variable shows the total number of channel entries that are assigned to each tag. It is not affected by the parameters specified. For example, specifying the status parameter would NOT affect the count on this variable.
total_results
{total_results}
This variable will return the total amount of tags results being displayed. You would typically use this in a conditional statement.
websafe_tag
{websafe_tag}
This variable will be replaced by a tag name where spaces have been replaced by plus signs (+). This makes the tags more safe to place in a URL and for compatibility with web apps like Reddit. You can also change the websafe seperator character by using the websafe_separator parameter.
Examples
Below is an example of how to display a list of top subscribed tags:
<ul>
{exp:tag:subscriptions_rank
orderby="subscription_rank"
sort="asc"
paginate="bottom"
limit="10"
}
<li>
[{absolute_count}] {tag} ({subscription_rank})
<a href="{subscribe_link}&return=template_group/template">
Subscribe
</a>
|
<a href="{unsubscribe_link}&return=template_group/template">
Unsubscribe
</a>
</li>
{paginate}
<li>{pagination_links}</li>
{/paginate}
{/exp:tag:subscriptions_rank}
</ul>