The medialist component is the most powerful component in the system, since media serves such an important role in the Newzulu Platform.
It allows you to display media from the system as either
NB: If you need to show the information for one particular media, then use fm:FileInfo.
The medialist component is used to display media such as:
In order to use the media attributes (such as id, title,thumbUrl, approvedcomments) in the templates, you must pass them in the "fields" reference for the MediaList component.
{$$media_title}
There are {$$media_approvedcomments} approved comments for this media.
The {$$media_publicUrl} variable is a link to the transcoded files:
To display a small thumbnail for a video, append "/11" to it.
For a direct link to a flash video file append "/21". Requests to this URL will log a hit.
Link to the video: {$$media_title}
Set countOnly to 1 to return only the number of records in the media list.
NOTE: Do NOT use the loop values (ie: loop.index) when countOnly is set to 1, because there are no values returned in this instance, just the number of media in the media list.
The number of media in channel=15509 is {$$totalCount}.
Set noCount to 1 to return only the records in the media list and NOT the totalCount.
While setting totalPages to 100 - which is incorrect, but in place to preserve backwards compatibilty on apps that may use this
totalCount {$$totalCount}
media_id {$$media_id} media_title {$$media_title}
Name | Required | Default | Description |
---|---|---|---|
behavior | Optional | mediaList | Callers can change retrieval behaviour of MediaList. May be one of:
|
cacheTimeOut | Optional | N/A | This attribute allows you to cache results for x seconds. Use the fm:Cache component instead. |
channel | Optional | 0 | The channel to filter on. This can be specified with either a shortname, or an id. |
collection | Optional | 0 | The collection to use to display media. This has to be specified by its id. |
context | Optional | "generic", if parentID is set then defaults to "comment" |
This is related to the parent and type of media.
|
countOnly | Optional | false | Set to 1 to return only the number of items in the media list. NOTE: Do NOT use the loop values (ie: loop.index) when countOnly is set to 1, because there are no values returned in this instance, just the number of media in the media list |
dateFormat | Optional | %Y-%m-%d %H:%i:%s | This attribute allows you to change the way dates are displayed within the list. By default it will be YYYY-MM-DD HH:MM:SS. The format which should be used is the same as PHP's date() function. |
endTime | Optional | N/A | This attribute filters by the upload date. No media past the endTime will be returned. Usually you should use YYYY-MM-DD format, but things like 'yesterday' will also work. |
evenClass | Optional | The contents of this attribute will be placed in the 'loop.evenClass' template variable, only for even row-numbers. This allows you to give every even row a specific css class | |
eventId | Optional | 0 | Show media associated to an event. This has to be specified by id. |
externalid | Optional | 0 |
Filters based on the contents of the external ID property of media items. If set this must be one of the following:
|
favorite_uid | Optional | N/A | This attribute allows you to fetch a user's favorites. Specify the user's id. |
fields | Optional | N/A | Comma separated list of fields to retrieve for this query. Remove "media_" from the template variable name to find the name you must provide in the fields list. e.g.: if you'd like to use the uploader's first name then you'll use the "media_user_firstname" template variable within the media list component. To specify you want this field retrieved you must list "user_firstname" in the fields attribute. |
fileTypes | Optional | 1,2,3,4 | Allows you to filter by a specific filetype. 1 = image, 2 = video, 3 = audio, 4 = text. You can supply multiple values by separating them with comma's |
geoBoundaries | Optional | N/A | Filter by latitude and longitude. Specify this as "{west longitude},{north latitude},{east longitude},{south latitude}". |
groupId | Optional | N/A | Only show media from a specific group |
hidden | Optional | N/A | One of "SHOWN" (default), "HIDDEN" (private), or "ALL". Usually this should only be set when a user filter is set as well to only show a specific user's hidden media. |
idList | Optional | N/A | Setting this will enable media_idlist, which is a comma separated list of IDs that matched the query |
includeChildGroups | Optional | 0 | Include media from the group/event specified with groupId/eventId as well as all their descendant groups. Must only be used when specifying a groupId/eventId filter. Valid values are "true", "false", "accepted" (or "approved"), "denied" and "notdenied". |
includeChildren | Optional | 0 | Only used in conjunction with a channel filter. This allows you to specify if you'd like to get all media from the specified channel + media from underlying channels (when nested channels are used). This is specified as 0 for false, 1 for true. |
moderationStatus | Optional | Project setting | This filter can be used to override a vhosts moderation setting. Possible values are unmoderated, accepted, denied, notdenied, moderated, all. Please note that media Moderation Status does not equal media Status: the former has to do with how the media is moderated once it has been uploaded while the latter has to do with the status of the upload (conversion). |
notuid | Optional | N/A | Filter by a specific user's id (provided as an integer), or list of ids (integers separated by commas), that don't match. |
oddClass | Optional | The contents of this attribute will be placed in the 'loop.oddClass' template variable, only for odd row-numbers. This allows you to give every odd row a specific css class | |
offset | Optional | 0 | Only show media starting with this number. If for example 5 is supplied, the list with start with the 5th item in the query. |
pageSize | Optional | 30 | The number of media-items per page. A maximum page size of 200 is enforced, attempting to set this to anything greater will cause the page size to revert to 200. |
parentID | Optional | 0 | Only return media with the specified parentID. Note that setting this causes "context" to default to "comment" |
parentUserID | Optional | N/A | Include only media whose parent's owner matches this ID. This must be used with a context filter restricting results to media with a parent (ie: context filter of "child", "comment", or "note"). Useful for showing all comments on any of a user's media in combination with the context filter |
searchQuery | Optional | N/A | Allows users to search for media matching the query. The filename, title, description and tags will be used for the search. |
shuffle | Optional | N/A | Setting this to true will return the returned results back in shuffled order. |
sort | Optional | upload DESC | Allows users to sort media by various fields (shown below in bullet points). Specifying "default" as sort method when a channel filter is specified, will use sort order set in the channel settings(eg. sort=default). Multiple sort fields may be specified separated by commas, eg: sort="commentcount DESC, upload DESC" Allows users to sort media using the following fields:
|
startPage | Optional | N/A | Specifies the start-page. This can be used in conjuction with pageSize. |
startTime | Optional | N/A | This attribute filters by the upload date. No media before the startTime will be returned. Usually you should use YYYY-MM-DD format, but things like 'yesterday' will also work. |
status | Optional | 3 | This filter selects media based on their upload status. Possible values are:
|
tag | Optional | N/A | This filter allows you to filter media by a specific tag. ie any alpha-numeric string |
uid | Optional | N/A | Filter by a specific user's id (provided as an integer), or list of ids (integers separated by commas). |
Name | Description |
---|---|
loop.hasResults | The contents of this variable will be either 0 or 1, depending on if there are items in the list. |
loop.oddClass | The contents of this variable will reflect the "oddClass" attribute. This will only be set for odd rownumbers. |
loop.evenClass | The contents of this variable will reflect the "evenClass" attribute. This will only be set for even rownumbers. |
loop.index | The 0-based index of the item in the loop. (Will contain 0,1,2,3,4, etc.) |
loop.count | The count of the current item in the loop. (Will contain 1,2,3,4,5 etc.) |
loop.currentPage | If a pager is involved in this loop, this will contain the current page number (0-based index). If page information is not available, this will be 0. |
loop.currentPage1 | This value is currentPage + 1. This number can be useful to display the current page number to use user. (people generally count from 1, not 0). |
loop.totalPages | Total number of pages avaiable in this loop. This will be 0 if the loop does not support paging. |
loop.totalItems | Total number of individual items. This will be 0 if the loop does not support paging. |
loop.pageSize | Total number of items on 1 single page. This will be 0 if the loop does not support paging. |
totalCount | The total number of media in this media list. |
media_approvedcomments | The total number of approved comments for this file. |
media_notdeniedcomments | The number of comments that have not been denied for this file. |
media_channel | The channel-id if the file was associated to a channel. |
media_channel_name | The name of the channel if the file was associated to a channel. |
media_channel_shortname | The 'shortname' of the channel if the file was associated to a channel. |
media_contenttype | The mimetype of the file, for example: audio/mp3. |
media_conversiontime | The time needed to transcode the file, in seconds. |
media_converttime | The date and time when the transcoding was completed for this file. |
media_commentcount | The total number of comments to this file. |
media_currentpage | The page number the user is currently on. |
media_date | The original creation date of the file. If we cannot detect this, this will be the same as the upload date. |
media_duration | The duration of the file in a human-readable format (example: 00:01:07). |
media_extension | The original file extension, for example 'mp4' |
media_filetype | The filetype. This is specified as a number between 1 and 4. Read below for more information. |
media_filename | The original filename |
media_filesize | The size of the file, in bytes. |
media_height | The height of the original file in pixels. |
media_hits | The number of views the file got. |
media_id | The unique id of the file. |
media_injector | A string describing the application that created the file, for example Uploader or Recorder. |
media_length | The duration of the file in as a floating point number in seconds. (example: 187.33, for 3 minutes, 7 seconds) |
media_message | The description of the file. |
media_metadata | User-defined or developer-defined meta-data for the media; the metadata can be defined in the mediadetail page (by the user) or in the API (by the developer). In the MediaList Component, its values can be read as: media_metadata.user.<key> Examples of keys are
|
media_ofilesize | The total size of all transcoded versions of this file, including thumbnails in bytes. |
media_offset | The offset of the current media-item within the current search query. The first item in the list will have 0, the second 1, the first item on the second page (if there are 30 items per page) will be 30 |
media_publicUrl | The base-url associated with the file. |
media_resumableUrl | The base-url associated with the file. Requests accept http ranges headers for resumable downloads |
media_rating | The average rating. This is a floating point number between 0 and 10. 2 decimals are provided. |
media_status | The status of the file. Generally this is always 3, meaning 'succesfully converted'. |
media_title | The title of the file. |
media_tags | A space delimited list of tags associated with the file. For example "amsterdam holiday". |
media_uid | The id of the user who uploaded the file. |
media_updownrating | This template variable will give you the "thumbs up/down" rating. The actual formula is actually based on the votecount and average rating, and assumes people rate 0 for down, and 10 for up. |
media_upload | The date and time the file was added to the Media Factory. |
media_uploadage | The time that has passed since the file was uploaded. The format will be for example 5 seconds, 20 minutes or 12 days. |
media_user_city | The submitter's city. |
media_user_country | The submitter's 2-letter country code. |
media_user_firstname | The submitter's first name. |
media_user_lastname | The submitter's last name. |
media_user_name | The username of the person uploading the file. |
media_user_nickname | The submitter's nickname. |
media_user_state | The 2-letter state or province code of the submitter. |
media_votecount | The total number of votes cast. |
media_width | The width of the original file in pixels. |
media_geo_latitude | The latitude of the file if available, otherwise empty. |
media_geo_longitude | The longitude of the file if available, otherwise empty. |
media_author | This field is used to retrieve the name entered by an anonymous user. Often used when users can comment without registering, by a captcha. |
media_processtime | The time spent fetching MediaList data |
media_idlist | A comma separated list of media ids |
This lists sorts all the media by the number of hits, and filters by a channel. Also, we're only retrieving text files
<fm:MediaList fields="id,title" channel="myBlog" sort="hits DESC" fileTypes="4" evenClass="even">
<fm:Loop>
<a href="/article/{$$media_id}" class="{$loop.evenClass}">{$$media_title}</a><br />
</fm:Loop>
<fm:NoResults>
No articles were found!
</fm:NoResults>
</fm:MediaList>
The media status refers to whether the media has uploaded (via the conversion process) succesfully, not been uploaded succesfully or in the process.
********* NB *********
The Media Status is NOT to be confused with the Media Moderation Status, which refers to whether the media has been accepted or denied during the moderation process.
Status Description
0 uploading
1 queued for conversion
2 converting
3 converted
4 failed conversion
100 trashed (any trashed status)
101 trashed while uploading
102 trashed while queued for conversion
103 trashed while converting
104 trashed after successful conversion
105 trashed after failed conversion
Media Moderation Status refers to whether the media has been accepted or denied during the moderation process.
********* NB *********
The Media Moderation Status is NOT to be confused with the Media Status, which refers to whether the media has uploaded (via the conversion process) succesfully or not.
There are also a lot of places where you can read on the current moderation status. We are moving towards standardization, so for any future system we will use the first column (the english words) media and comments use the values from the second column.
Standard Media status Description
unmoderated 0 Unmoderated content
accepted 1 Approved content
denied 2 Denied content
notdenied 3 Not Denied content
moderated 6 All moderated media (approved and denied media)
all -1 All media (approved, denied, and unmoderated media)
The following code shows the media title, media.metadata.user.synopsis and media.metadata.user.pin in a medialist.
Title: {$$media.title}, media.metadata.user.synopsis {$$media.metadata.user.synopsis}, media.metadata.user.pin {$$media.metadata.user.pin}
This lists shows 84x84 jpeg thumbnail for all image and video uploads. We set the limit for this gallery to 100.
This lists shows videoplayers, audio players, text entries and large images. Because a lot of flash on one page is a bad idea, we set the limit to 10.
{$$media_title}
{$$media_message}
Submitted by {$$media_user_name} on {$$media_upload}
This text file was brought to you by cheesy poofs