Skip to content
  1. Extras
  2. ResVideoGallery
  3. ResVideoGallery for MODX 2

ResVideoGallery for MODX 2 ​

Responsive video gallery with Ajax loading for MODX Revolution 2.x. For MODX 3, see ResVideoGallery for MODX 3.

Supported video hosts:

  • youtube.com
  • vimeo.com
  • dailymotion.com
  • rutube.ru
  • vk.com
  • coub.com

ResVideoGallery (old video)

RuTube

Snippets ​

ResVideoGallery ​

Snippet for outputting video on a page.

Parameters ​

ParameterDefaultDescription
autoPlay1Start video playback automatically.
parentsComma-separated list of parent IDs for the search. By default the search is limited to the current parent. Use 0 for no limit.
resourcesCurrent resource IDComma-separated list of resource IDs to include. If an ID is prefixed with a minus sign, that resource is excluded.
showInactive0Include inactive video.
limit12Number of videos to output. Use 0 for no limit.
offset0Number of results to skip from the start.
sortbyrankSort field.
sortdirDESCSort direction.
whereJSON string for the SQL WHERE clause. Example: &where={"template":15} (no TV).
tagsComma-separated list of tags; only video that has these tags is included.
getTags0Make extra queries to load tags?
tagsVartagIf set, the snippet reads the "tags" value from $_REQUEST["name"]. E.g. if you set "tag", the snippet only outputs files matching $_REQUEST["tag"].
photoGalleryInclude photo gallery files with the video. One of: ms2Images or ms2Gallery (miniShop2 gallery or MS2Gallery).
primarilyvideoOutput priority: video or photo.
thumbsmallThumbnail size name for the photo gallery. From the file source thumbnails option.
ajaxModebuttonAJAX pagination mode: button or scroll.
plPrefixPlaceholder prefix.
tplresVideoGalleryTplFenom chunk for the whole gallery.
tplRowresVideoGalleryRowTplFenom chunk for one gallery item.
tplEmbedresVideoGalleryEmbedTplFenom chunk for the video player code.
css{+assets_url}css/web/default.cssPath to custom styles, or clear and load them manually in the site template.
js{+assets_url}js/web/default.jsPath to custom scripts, or clear and load them manually in the site template.

Video preview size ​

Previews are generated via phpThumb. You can set its parameters in the component settings; the default is:

json
{"w":640,"h":390,"q":90,"zc":"1","f":"jpg","bg":"000000"}
ResVideoGallery with Ajax load on button click for resource ID 5 ​
modx
[[!ResVideoGallery?
  &limit=`3`
  &resources=`5`
]]
ResVideoGallery with Ajax load on scroll for resource ID 5 ​
modx
[[!ResVideoGallery?
  &limit=`3`
  &resources=`5`
  &ajaxMode=`scroll`
]]
ResVideoGallery via pdoPage for pagination for resource ID 5 ​
modx
[[!pdoPage?
  &element=`ResVideoGallery`
  &ajaxMode=`default`
  &limit=`4`
  &resources=`5`
]]

[[!+page.nav]]
ResVideoGallery with miniShop2 photo gallery (video and photos together) ​
modx
[[!ResVideoGallery?
  &limit=`3`
  &resources=`5`
  &photoGallery=`ms2Images`
]]

ResVideoGalleryTags ​

Snippet for outputting a tag cloud with filtering.

Parameters ​

ParameterDefaultDescription
parentsComma-separated list of parent IDs for the search. By default the search is limited to the current parent. Use 0 for no limit.
resourcesCurrent resource IDComma-separated list of resource IDs to include. If an ID is prefixed with a minus sign, that resource is excluded.
showInactive0Include inactive video.
limit0Number of videos to output. Use 0 for no limit.
offset0Number of results to skip from the start.
sortbytagSort field.
sortdirASCSort direction.
whereJSON string for the SQL WHERE clause. Example: &where={"template":15} (no TV).
tagsVartagIf set, the snippet reads the "tags" value from $_REQUEST["name"]. E.g. if you set "tag", the snippet only outputs files matching $_REQUEST["tag"].
tplresVideoGalleryTagsTplFenom chunk for the snippet output.

ResVideoGalleryUpload ​

Snippet for adding video from the frontend.

ResVideoGalleryUpload outputs a form that lets users add video via Ajax.

Parameters ​

ParameterDefaultDescription
resourceCurrent resource IDResource ID to add video to.
active1Video active after add.
onlyAuth1Show form only to logged-in users.
usergroupsComma-separated user groups that can see the form.
multiple1Allow adding multiple videos at once.
tagsComma-separated tags added to user-provided tags.
allowTagsHTML tags allowed in title/description (strip_tags).
css{+assets_url}css/web/default.cssPath to custom CSS, or empty to load manually.
js{+assets_url}js/web/default.jsPath to custom JS, or empty to load manually.

resVideoGallery frontend add video (old)

Adding a custom video parser ​

To add your own video parser, create a PHP file in core/components/resvideogallery/model/resvideogallery/providers with a class extending RvgProvider, define the "scrape" method and override the required properties.

Events ​

Available events:

  • rvgOnBeforeVideoAdd
    • properties - request params
  • rvgOnAfterVideoAdd - video added
    • video - RvgVideos instance
    • properties - request params
  • rvgOnBeforeVideoUpdate
  • rvgOnAfterVideoUpdate - video updated
    • video - RvgVideos instance
    • properties - request params
  • rvgOnBeforeVideoRemove
  • rvgOnAfterVideoRemove - video removed
    • video - RvgVideos instance
  • rvgOnBeforeThumbUpdate
  • rvgOnAfterThumbUpdate - video thumbnail updated
    • properties - request params
    • video - RvgVideos instance
  • rvgOnGetVideoEmbed - video embed code
    • data - video data array

VKontakte setup ​

  1. Sign up and log in to VKontakte.
  2. Open the App Manager.
  3. Create an app in VK. Set a name and choose Standalone type.
  4. Enable the app by changing the State select and save.
  5. Go to settings and copy the app ID. Replace {APP_ID} in https://oauth.vk.com/authorize?client_id={APP_ID}&scope=offline,video&redirect_uri=https://oauth.vk.com/blank.html&display=page&v=5.73&response_type=token and open in browser.
  6. Click Allow in the dialog.
  7. You'll get a URL like https://oauth.vk.com/blank.html#access_token=...&expires_in=0&user_id=... — copy the access_token. If you see {"error":"invalid_request","error_description":"Security Error"}, log out of VK and log in again.
  8. In MODX: System Settings → ResVideoGallery, paste the access_token into "Access Token for VKontakte".