{jrCore_list} gets a list of items from a module and shows them with a template. Most lists on a Jamroom site are made with it.
This example lists the 5 newest active profiles that have a profile image:
{jrCore_list module="jrProfile" order_by="_created desc" search1="profile_active = 1" require_image="profile_image" limit="5" template="index_list_profiles.tpl"}| Parameter | What it does here |
|---|---|
module="jrProfile" |
List profiles. Any module with items works: jrAudio, jrBlog, and so on. |
order_by="_created desc" |
Newest first. _created is when the item was created; desc is descending. |
search1="profile_active = 1" |
Only active profiles. Add search2, search3 and so on for more conditions. |
require_image="profile_image" |
Only items that have this image |
limit="5" |
At most 5 items |
template="index_list_profiles.tpl" |
The template that shows each item, from the active skin's folder |
The field names in a search, such as profile_active, are the item's fields. The DataStore Browser on the module's Tools tab shows them.
The list template gets the items in $_items. A simple index_list_profiles.tpl:
{if isset($_items)}
{foreach $_items as $item}
<div class="item">
<a href="{$jamroom_url}/{$item.profile_url}">{jrImage_display module="jrProfile" type="profile_image" item_id=$item._profile_id size="small" crop="auto" alt=$item.profile_name}</a>
<a href="{$jamroom_url}/{$item.profile_url}">{$item.profile_name}</a>
</div>
{/foreach}
{/if}{if isset($_items)} shows nothing if no items were found.{foreach} repeats the block for each item. Inside it, $item is the current item, and $item.profile_name is one of its fields.$jamroom_url is your site's address.{jrImage_display} shows the profile image. size="small" is 72 pixels; see Image Support for the sizes.For every parameter of jrCore_list, see {jrCore_list}.