<v:collection>
Iterates over a Vae Collection and renders the text and tags inside once for every entry. This tag is very flexible: you can paginate, search, and sort the collection directly in this tag.
You may nest a <v:divider>
tag inside this tag to
specify a divider that is shown after each entry or after a certain
number of entries. Dividers can also wrap the entry content.
Required Attributes
path
- path to the collection you would like to render. Uses VaeQL syntax.
Optional Attributes
-
all
- if using pagination, you can set this to the ID of a<v:a>
element that will be used as a link that will show all entries on one page, bypassing the pagination. -
default_page
- applies if you are using pagination on this collection. If set to a number, that page number will be the default page shown. If set tolast()
, the last page will be the default page shown. -
filter
- specify text representing a search query. Only entries matching the search query will be returned. -
filter_input
- specify the name of a GET or POST parameter containing a search query. Only entries matching the search query will be returned. -
groups
- If you want display to different parts of the same collection on a page (for example half in a left column and half in a right column), set this attribute to the number of places you are putting the collection. See the samples below for more information. -
max_pages
- If using pagination, and this attribute is set to a number, no more than this many pages will be generated. -
next
- if using pagination, this is the ID of a<v:a>
element that will be used as the link to navigate to the next page. -
order
- If set to the the name of a structure in this collection, the collection will be sorted by that structure. You may also sort by multiple structures by separating them with a comma. You may sort by a structure in descending order by wrapping the structure name withDESC()
, such asDESC(name)
. You may sort by the number of entries in a child collection by wrapping the child collection name withCOUNT()
, such asCOUNT(comments)
. You can reverse the order stored in Vae by setting this attribute toDESC()
. You can display elements in a random order by setting this attribute toRAND()
. -
output_order
- If set toreverse
, the elements in your collection will be rendered in reverse order. Note that if you are using pagination, this will only render the items on the current page in reverse. No other pages will be affected. Items will be on the same page that they would have been without this attribute set. -
page_select
- if usingpagination
, this is the ID of a<v:select>
element that will be used as the link to navigate to other pages. This element must come after the collection in the page. You only need to specify anid
attribute in the<v:select>
tag. -
paginate
- show no more than this many items per page. -
per_row
- this attribute allows<v:collection>
to easily build a table by filling rows across. Set this attribute to the number of columns that should be in the table.<tr>
tags will be generated automatically, but the contents of this tag should begin and end with a<td>
and</td>
tag. Please see the example literal. -
previous
- if using pagination, this is the ID of a<v:a>
element that will be used as the link to navigate to the previous page. This element must come after the collection in the page. You only need to specify anid
attribute in the<v:a>
tag. -
skip
- if set to a number, that many items will be skipped before listing any contents. -
store_in_session
- If set, a comma-delimited list of the permalinks of all items that match this path and filter, in the sorted order, will be stored in the session under this name. Useful in combination with<v:session_dump>
. -
unique
- If set to the the name of a structure in this collection, only unique values of that entry will be returned. You may require a unique combination of values in multiple structures by listing each structure separated by a comma. -
wrap
- if set totrue
and using pagination, the Next link on the last page will link to the first page and the Previous page on the first page will link to the last page. In other words, it wraps around.
See Also
<v:if_paginate>
, <v:pagination>
.
Sample Usage
Basic Sample:
Sample using the groups
attribute:
Sample using the per-row
attribute:
Sample search results page:
Sample with sorting:
Samples with pagination: