fm:MediaNext


Makes information about the next media item from a media list available.

Example

<fm:MediaNext> <fm:Loop> <a href="/mediadetail/{$$media_id}?{$$filter_string}">Next</a> </fm:Loop> <fm:NoResults> This is the first item </fm:NoResults> </fm:MediaNext>

This component is intended to be used within a template arrived at from a media list component. It will accept the same filters and sorting options as a media list and make available details about the next media item in that list.

All attributes from the fm:MediaList component are supported with the exception of "pageSize" and "startPage". Most of these supported attributes may also be set via GET variables (the query string). Any filters or sorting set via attributes will override the same parameters within GET variables. This allows the developer to have this component only show the next media item matching specific filters without allowing the end user to bypass the filtering. You must provide an "offset" value for this component, leaving this attribute unset will generate an error. This can be accessed via the "filter_string" template variable provided by the fm:MediaList component or you can explicitly set this by accessing the "offset" template variable provided by the fm:MediaList component.

Below is another example showing a more complex usage of the fm:MediaNext component. This will provide a link to the next media item and show its thumbnail if available. This also demonstrates how we can ensure certain filters are not overridden by the user. By specifying the "channel" and "startTime" attributes we can be certain that the user is not able to modify these values within the query string to circumvent your business logic.

<fm:MediaNext channel="123" startTime="now -1 week"> <fm:Loop> <a href="/mediadetail/{$$media_id}?{$$filter_string}"> <fm:Switch value="{$$media_filetype}"> <fm:Case multiValue="0"> Next </fm:Case> <fm:Case multiValue="1,2"> <img src="{$$media_thumbUrl}/11" /> </fm:Case> <fm:Case multiValue="3"> <img src="/static/5/icons/media/audio_medium.png" /> </fm:Case> <fm:Case multiValue="4"> <div class="mediaPreview"> <div class="thumb"> <fm:MediaViewer messageLength="100" /> </div> </div> </fm:Case> </fm:Switch> <img class="arrownext" src="/static/2/images/icons/buttons/control_fastforward.png" /> </a> </fm:Loop> </fm:MediaNext>

Supported attributes

NameRequiredDefaultDescription
behaviorOptionalmediaListCallers can change retrieval behaviour of MediaList. May be one of:
  • mediaList - Retrieve a list of media.
  • mediaByMetaData - Retrieve a list of media from Sphinx
cacheTimeOutOptionalN/AThis attribute allows you to cache results for x seconds. Use the fm:Cache component instead.
channelOptional0The channel to filter on. This can be specified with either a shortname, or an id.
collectionOptional0The collection to use to display media. This has to be specified by its id.
contextOptional"generic", if parentID is set then defaults to "comment" This is related to the parent and type of media.
  • generic - only normal media (no comments or notes)
  • all - all media
  • comment - only comments
  • note - only moderators' notes
  • commentnote - only comments and moderators' notes
  • genericcomment - everything but notes (comments and regular media)
  • parent - only parent media (deprecated)
  • child - only child media (deprecated)
countOnlyOptionalfalseSet 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
dateFormatOptional%Y-%m-%d %H:%i:%sThis 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.
endTimeOptionalN/AThis 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.
evenClassOptionalThe 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
eventIdOptional0Show media associated to an event. This has to be specified by id.
externalidOptional0 Filters based on the contents of the external ID property of media items. If set this must be one of the following:
  • 0 - Do not filter based on external ID.
  • exists - Include only media that has an external ID set.
  • mediaType={image|video|audio|text|unknown}[,...]
    - Include only media of the specified type(s) that have an external ID set, media of other types will be included regardless of their external IDs. e.g.: "mediaType=image,video" - this will only include images and videos that have an external ID set; audio, text, and unknown media types will be included even if they do not have an external ID set.
  • other - Include only media that has the exact external ID specified.
favorite_uidOptionalN/AThis attribute allows you to fetch a user's favorites. Specify the user's id.
fieldsOptionalN/AComma 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.
fileTypesOptional1,2,3,4Allows 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
geoBoundariesOptionalN/AFilter by latitude and longitude. Specify this as "{west longitude},{north latitude},{east longitude},{south latitude}".
groupIdOptionalN/AOnly show media from a specific group
hiddenOptionalN/AOne 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.
idListOptionalN/ASetting this will enable media_idlist, which is a comma separated list of IDs that matched the query
includeChildGroupsOptional0Include 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".
includeChildrenOptional0Only 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.
moderationStatusOptionalProject settingThis 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).
notuidOptionalN/AFilter by a specific user's id (provided as an integer), or list of ids (integers separated by commas), that don't match.
oddClassOptionalThe 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
offsetOptional0Only show media starting with this number. If for example 5 is supplied, the list with start with the 5th item in the query.
parentIDOptional0Only return media with the specified parentID. Note that setting this causes "context" to default to "comment"
parentUserIDOptionalN/AInclude 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
searchQueryOptionalN/AAllows users to search for media matching the query. The filename, title, description and tags will be used for the search.
shuffleOptionalN/ASetting this to true will return the returned results back in shuffled order.
sortOptionalupload DESCAllows 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:
  • approvedcomments - The number of approved comments for the media
  • channel - The channel that the media belongs to.
  • commentcount - The number of comments for the media.
  • contenttype - The contenttype of the media.
  • conversiontime - The length of time that the media took to convert (in seconds).
  • converttime - The date and time that the media was converted.
  • date - The date and time that the media was uploaded to Media Factory.
  • duration - The duration length of the media.
  • extension - The extension of the media
  • filesize - The file-size of the media
  • filetype - The filetype of the media. ie: 1 (image), 2 (video), 3 (audio), 4 (text)
  • geo_latitude - The geo latitude of the media
  • geo_longitude - The geo longitude of the media
  • groupposition - Based on the position field for media stored within a group.
  • height - height of the media.
  • hits - The number of hits that the media has received.
  • id - The id of the media
  • injector - The injector of the media
  • lastupdatetime - The date and time that the media was last updated.
  • length - The duration length of the media.
  • message - The message of the media
  • moderationstatus - The moderationstatus of the media. ie: 0 (unmoderated), 1 (accepted), 2 (denied), 3 (notdenied), -1 (all)
  • notdeniedcomments - The number of 'notdenied' comments for the media
  • offensive - Whether the media is marked as offensive
  • ofilesize - The media's ofilesize.
  • parentid - The media id of the parent os the media.
  • rating - The rating of the media.
  • tags - The media's tags
  • title - The title of the media
  • uid - The user id for the owner of the media.
  • upload - The upload date and time of the media.
  • user_city - The city of the media's owner.
  • user_country - The country of the media's owner.
  • user_firstname - The media owner's firstname
  • user_lastname - The media owner's lastname
  • user_name - The media owner's username
  • votecount - The number of votes that the media has received.
  • width - The width of the media.
startTimeOptionalN/AThis 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.
statusOptional3This filter selects media based on their upload status. Possible values are:
  • 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)
Please note that media media Status does not equal media Moderation Status: the former has to do with the status of the media upload (via the conversion process) while the latter has to do with how the media is moderated once it has been uploaded.
tagOptionalN/AThis filter allows you to filter media by a specific tag. ie any alpha-numeric string
uidOptionalN/AFilter by a specific user's id (provided as an integer), or list of ids (integers separated by commas).

Deprecated Attributes

The following fields for the 'fields' attribute are supported:

  • accounttype
  • active
  • address1
  • address2
  • approvedcomments
  • approvedfiles
  • avatar
  • birthdate
  • cellphone
  • city
  • country
  • created
  • deniedcomments
  • deniedfiles
  • description
  • disable_media_notifications
  • disable_thread_notifications
  • disabled
  • email
  • firstname
  • followers
  • following
  • friends
  • gender
  • geo_latitude
  • geo_longitude
  • id
  • language
  • lastlogin
  • lastname
  • meta
  • newsletter
  • nickname
  • occupation
  • phone
  • pointtotal
  • postalcode
  • profile_complete
  • publicfiles
  • state
  • unmoderatedcomments
  • unmoderatedfiles
  • user
  • vhost
  • website

Template variables

NameDescription
loop.hasResultsThe contents of this variable will be either 0 or 1, depending on if there are items in the list.
loop.oddClassThe contents of this variable will reflect the "oddClass" attribute. This will only be set for odd rownumbers.
loop.evenClassThe contents of this variable will reflect the "evenClass" attribute. This will only be set for even rownumbers.
loop.indexThe 0-based index of the item in the loop. (Will contain 0,1,2,3,4, etc.)
loop.countThe count of the current item in the loop. (Will contain 1,2,3,4,5 etc.)
loop.currentPageIf 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.currentPage1This 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.totalPagesTotal number of pages avaiable in this loop. This will be 0 if the loop does not support paging.
loop.totalItemsTotal number of individual items. This will be 0 if the loop does not support paging.
loop.pageSizeTotal number of items on 1 single page. This will be 0 if the loop does not support paging.
totalCountThe total number of media in this media list.
media_approvedcommentsThe total number of approved comments for this file.
media_notdeniedcommentsThe number of comments that have not been denied for this file.
media_channelThe channel-id if the file was associated to a channel.
media_channel_nameThe name of the channel if the file was associated to a channel.
media_channel_shortnameThe 'shortname' of the channel if the file was associated to a channel.
media_contenttypeThe mimetype of the file, for example: audio/mp3.
media_conversiontimeThe time needed to transcode the file, in seconds.
media_converttimeThe date and time when the transcoding was completed for this file.
media_commentcountThe total number of comments to this file.
media_currentpageThe page number the user is currently on.
media_dateThe original creation date of the file. If we cannot detect this, this will be the same as the upload date.
media_durationThe duration of the file in a human-readable format (example: 00:01:07).
media_extensionThe original file extension, for example 'mp4'
media_filetypeThe filetype. This is specified as a number between 1 and 4. Read below for more information.
media_filenameThe original filename
media_filesizeThe size of the file, in bytes.
media_heightThe height of the original file in pixels.
media_hitsThe number of views the file got.
media_idThe unique id of the file.
media_injectorA string describing the application that created the file, for example Uploader or Recorder.
media_lengthThe duration of the file in as a floating point number in seconds. (example: 187.33, for 3 minutes, 7 seconds)
media_messageThe description of the file.
media_metadataUser-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
  • 'synopsis' - read as: media_metadata.user.synopsis
  • 'pin' - read as: media_metadata.user.pin
media_ofilesizeThe total size of all transcoded versions of this file, including thumbnails in bytes.
media_offsetThe 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_publicUrlThe base-url associated with the file.
media_resumableUrlThe base-url associated with the file. Requests accept http ranges headers for resumable downloads
media_ratingThe average rating. This is a floating point number between 0 and 10. 2 decimals are provided.
media_statusThe status of the file. Generally this is always 3, meaning 'succesfully converted'.
media_titleThe title of the file.
media_tagsA space delimited list of tags associated with the file. For example "amsterdam holiday".
media_uidThe id of the user who uploaded the file.
media_updownratingThis 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_uploadThe date and time the file was added to the Media Factory.
media_uploadageThe time that has passed since the file was uploaded. The format will be for example 5 seconds, 20 minutes or 12 days.
media_user_cityThe submitter's city.
media_user_countryThe submitter's 2-letter country code.
media_user_firstnameThe submitter's first name.
media_user_lastnameThe submitter's last name.
media_user_nameThe username of the person uploading the file.
media_user_nicknameThe submitter's nickname.
media_user_stateThe 2-letter state or province code of the submitter.
media_votecountThe total number of votes cast.
media_widthThe width of the original file in pixels.
media_geo_latitudeThe latitude of the file if available, otherwise empty.
media_geo_longitudeThe longitude of the file if available, otherwise empty.
media_authorThis field is used to retrieve the name entered by an anonymous user. Often used when users can comment without registering, by a captcha.
media_processtimeThe time spent fetching MediaList data
media_idlistA comma separated list of media ids

Deprecated Template Variables

See also