Retired Documentation:  You are using the documentation for version 1.7.3 which was retired in 2013. Go here for the latest version documentation or check here for your available upgrades to the latest version.

Photo Gallery Categories

The Photo Gallery Categories Tag shows a listing of all the categories/sub-categories in the gallery, as in this example:

Categories

Normally this appears on the gallery front page. The name of the category will typically be a link pointing to the page that shows all the thumbnails in the particular category.

Here is an example of the Categories Tag:

{exp:gallery:categories gallery="GALLERY_NAME"}

<table cellpadding="6" cellspacing="1" border="0" width="100%">
<th>Category</th>
<th>Description</th>
<th>Files</th>
<th>Comments</th>
<th>Views</th>

{category_row}

{row_start}<tr>{/row_start}

{row}
<td><a href="{category_path='gallery/category'}">{category}</a></td>
<td>{category_description}</td>
<td>{total_files}</td>
<td>{total_comments}</td>
<td>{total_views}</td>
{/row}

{row_end}</tr>{/row_end}

{/category_row}

</table>

{/exp:gallery:categories}

Parameters

gallery=

gallery="vacations"

The name (short name) of the gallery for which you wish to display the categories. This is a required parameter.

Single Variables

These are available for use between the {row} {/row} variable pair.

All variables are available for conditional use. e.g.

{if total_files > 0}
content
{/if}

category

{category}

This variable simply displays the name of the category.

category_description

{category_description}

This variable simply displays the content from the "category description" field.

category_id

{category_id}

This variable simply displays the ID of the category.

category_path='

{category_path=gallery/category'}

The path (template_group/template) where you want the category links to point. This is typically used within a standard HTML link tag:

<a href="{category_path='gallery/category'}">{category}</a>

recent_entry_date

{recent_entry_date format="%Y %m %d"}

The date of the most recent entry in the category. See the date variable formatting page for more information.

total_comments

{total_comments}

The total number of comments associated with entries in this category.

total_files

{total_files}

The total number of files in this category.

total_views

{total_views}

The total combined number of views of entries in this category.

Variable Pairs

category_row

{category_row}

{row_start}<tr>{/row_start}

{row}
<td><a href="{category_path='gallery/category'}">{category}</a></td>
<td>{total_files}</td>
{/row}

{row_end}</tr>{/row_end}

{/category_row}

The entire repeating category "row". This includes any starting or ending content for each "row".

row

{row}
<td><a href="{category_path='gallery/category'}">{category}</a></td>
<td>{total_files}</td>
{/row}

The category "row" contents. In the context of a table, you could think of these as the individual cells in a row.

row_end

{row_end}</tr>{/row_end}

The ending declaration of the row. In the context of a table, you could think of this as the "</tr> tag.

row_start

{row_start}<tr>{/row_start}

The starting declaration of the row. In the context of a table, you could think of this as the "<tr> tag.

subcat_marker

{subcat_marker}<img src="/images/cat_marker.gif" alt="" />{/subcat_marker}

The sub-category marker. Generally, this is an indentation image to show the relationship between a parent category and a child. Note: This can only be used within the {row} {/row} variable pair.

subcategory_row

{subcategory_row}{/subcategory_row}

The entire repeating subcategory "row". This includes any starting or ending content for each "row".

Displaying Subcategories

There are two general approaches to displaying your subcategories and differentiating them from the main categories.

Subcategory Markers

The first way you can differentiate your subcategories is to designate a specific marker to be used when displaying a subcategory row (but not a main category row). This is done with the {subcat_marker} {/subcat_marker} variable pair.

This marker will be shown only preceding each sub-category. Note: The marker will be indented automatically based on the number of sub-categories. The marker can be added wherever you want the marker to appear within the {row} {/row}.

Example:

{exp:gallery:categories gallery="vacations"}

<table cellpadding="6" cellspacing="1" border="0" width="100%">
<th>Category</th>
<th>Description</th>
<th>Files</th>
<th>Comments</th>
<th>Views</th>

{category_row}

{row_start}<tr>{/row_start}

{row}
<td>{subcat_marker}<img src="/images/marker.gif" alt="" />{/subcat_marker}&nbsp;<a href="{category_path='gallery/category'}">{category}</a></td>
<td>{category_description}</td>
<td>{total_files}</td>
<td>{total_comments}</td>
<td>{total_views}</td>
{/row}

{row_end}</tr>{/row_end}

{/category_row}

</table>

{/exp:gallery:categories}

Subcategory Rows

For those who want absolute control over the presentation of subcategories in order to show them totally differently, you may use a separate "category row" variable pair so that you can differentiate regular categories from subcategories. This is the {subcategory_row} {/subcategory_row} variable pair.

You use this by specifying both the {category_row} {/category_row} and {subcategory_row} {/subcategory_row} content.

Example:

{exp:gallery:categories gallery="vacations"}

<table cellpadding="6" cellspacing="1" border="0" width="100%">
<th>Category</th>
<th>Description</th>
<th>Files</th>
<th>Comments</th>
<th>Views</th>

{category_row}

{row_start}<tr>{/row_start}

{row}
<td><a href="{category_path='gallery/category'}">{category}</a></td>
<td>{category_description}</td>
<td>{total_files}</td>
<td>{total_comments}</td>
<td>{total_views}</td>
{/row}

{row_end}</tr>{/row_end}

{/category_row}

{subcategory_row}

{row_start}<tr>{/row_start}

{row}
<td><img src="/images/marker.gif" alt="" />&nbsp;<a href="{category_path='gallery/category'}">{category}</a></td>
<td>{category_description}</td>
<td>{total_files}</td>
<td>{total_comments}</td>
<td>{total_views}</td>
{/row}

{row_end}</tr>{/row_end}

{/subcategory_row}

</table>

{/exp:gallery:categories}

Top of Page