Tag 2.1 Related Gallery Entries
Everyone loves images. Pull in photo gallery images that share the same tags as the main entry of your page, whether that entry is from a weblog or a photo gallery.
Parameters
entry_id=
entry_id="{entry_id}"
Normally 'tag:related_entries' will simply pull an entry id or url title from the URL then fetch entries related to the main entry by shared tags. If you like, you can force a primary entry by passing the entry ID parameter.
exclude=
exclude="tacos|nachos|peanut"
The 'exclude' parameter allows you to exclude entries based on specified tags from showing up. For multiples, add pipe.
gallery=
gallery="gallery_name"
The 'tag:related_gallery_entries' takes the same parameters as 'gallery:entries'. Make sure you supply a gallery in the 'gallery' parameter or you will get no results.
rank_limit=
rank_limit="5"
Every tag on your site has at least one entry assigned to it. Some tags are used by more entries than others. As such, there is a ranking of tags. If you want to show some number of the top related entries based on tag ranking you can use the 'rank_limit' parameter. This parameter is designed to filter out the clutter. There may be many many entries related to your main entry by virtue of all the shared tags, but you don't want to show them all. You may want a filtered list of entries based on sharing the highest ranked tags. But it gets better, tags can be ranked in one of three ways. Tags can be ranked by how often they are used, by how often they are clicked or both. See the 'rank_method' parameter below. Important: Using this parameter, you are only limiting the number of related entries by those of a certain tag rank. The entries are not ordered by rank. Rather, they are ordered by standard weblog:entries ordering preferences.
rank_method=
rank_method="clicks|total_entries"
The Tag module ranks tags. A tag can be ranked by how often it is clicked on the site, by how many entries use it, or both. You can show related entries by tag rank and you can establish the ranking method using this parameter. Allowed values are 'clicks' and 'total_entries'. You can indicate both by joining the two with a pipe '|'.
Variables
All of the variables available in the gallery:entries tag are available here. Be careful of variable collisions between this function and the gallery:entries function if you decide to call this function inside a gallery:entries tag pair. If you need to do something nutty like this, put your related entries code in a separate template and embed it inside your gallery:entries tag.
Variable Pairs
This function requires all of the variable pairs that gallery:entries does. Make sure not to forget them. See example below.
Conditionals
All of the conditionals available in the gallery:entries tag are available here.
Examples
<div class="entry">
<h3>Gallery entries related by tag</h3>
{exp:tag:related_gallery_entries gallery="gallery" rank_limit="2" rank_method="clicks|entries" paginate="bottom"}
<table class="tableBorder" cellpadding="6" cellspacing="1" border="0" width="100%">
<tr>
<th colspan=’4’>Most Recent Images</th>
</tr>
{entries}
{row_start}<tr>{/row_start}
{row}
<td class="thumbs">
<a href="{id_path=gallery/image_med}" onclick="window.open(this.href, ‘_blank’, ‘width=700,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes’);return false;” ><img src="{thumb_url}" class="border" width="{thumb_width}" height="{thumb_height}" border="0" title="{title}" /></a>
<div class="title">{title}</div>
</td>
{/row}
{row_blank}<td class="thumbs"> </td>{/row_blank}
{row_end}</tr>{/row_end}
<tr class="tags"><td>Tags {entry_id}
{exp:tag:tags entry_id="{entry_id}" type="gallery"}<a href="{path=’tags/tag’}{websafe_tag}">{tag_name}</a> {/exp:tag:tags}
</td></tr>
{/entries}
</table>
<hr />
{paginate}{pagination_links}{/paginate}
{/exp:tag:related_gallery_entries}
</div>