Hi,
Scenario: I'm using MIGX to build a media centre and things are going pretty well. However, now the client has made a request which seems really simple but I'm struggling with.
At the moment I have set up the documents as below, with an images MIGX and a videos MIGX on the respective pages because I need to have images, and video from Vimeo and Youtube, in the media centre, so I have two slightly different MIGXs. The difference is that the image MIGX has the image with a self-generated PhpThumbOf thumbnail, and the video MIGX has an iframe and manually selected thumbnail (they are then both shown in a lightbox).
Project 1
- Images (has a mediaCentreImages MIGX)
- Video (has a mediaCentreVideo MIGX)
Project 2
- Images (has a mediaCentreImages MIGX)
- Video (has a mediaCentreVideo MIGX)
Project 3 etc...
They are also under image and video pages so they can be tagged (by project, region, market and media type) and filtered using AdvSearch Query Hooks, and everything works - everything works and filters perfectly.
Problem: Now the client would like to show just 5 media results for each project, on another page, and this would ideally be a random selection of media items from each project, (images and video). Because they are in separate MIGXs, I can't get them to merge and display together, limited to 5, and with a random combination of media types.
The MIGX's are:
[
{"caption":"Add Media", "fields": [
{"field":"title","caption":"Title","description":"mediaTitle"}, {"field":"description","caption":"Description","description":"mediaDescription"},
{"field":"image","caption":"Image","inputTV":"mediaImage"},
{"field":"date","caption":"Date","inputTV":"mediaDate"}
]}
]
[
{"header": "Title", "width": "160", "sortable": "true", "dataIndex": "title"},
{"header": "Description", "width": "160", "sortable": "true", "dataIndex": "description"},
{"header": "Image", "width": "50", "sortable": "false", "dataIndex": "image","renderer": "this.renderImage"},
{"header": "Date", "width": "160", "sortable": "true", "dataIndex": "date"}
]
[[!getImageList?
&tvname=`mediaCentreImages`
&tpl=`mediacentreImage`
&docid=`[[+id]]`
]]
and
[
{"caption":"Add Media", "fields": [
{"field":"title","caption":"Title","description":"mediaTitle"}, {"field":"description","caption":"Description","description":"mediaDescription"},
{"field":"embed","caption":"Embed","description":"mediaEmbed"},
{"field":"image","caption":"Image","inputTV":"mediaImage"},
{"field":"date","caption":"Date","inputTV":"mediaDate"}
]}
]
[
{"header": "Title", "width": "160", "sortable": "true", "dataIndex": "title"},
{"header": "Description", "width": "160", "sortable": "true", "dataIndex": "description"},
{"header": "Embed", "width": "160", "sortable": "true", "dataIndex": "embed"},
{"header": "Image", "width": "50", "sortable": "false", "dataIndex": "image","renderer": "this.renderImage"},
{"header": "Date", "width": "160", "sortable": "true", "dataIndex": "date"}
]
[[!getImageList?
&tvname=`mediaCentreVideos`
&tpl=`mediacentreVideo`
&docid=`[[+id]]`
]]
I know the below is gobbledygook and doesn't work, but this is basically what I would like to do – so far I can't work out a way to get what I want using getResources:
[[!getImageList?
&tvname=`mediaCentreImages,mediaCentreVideos`
&tpl=`mediacentreImage,mediacentreVideo`
&docid=`[[+id]]`
&limit=`5`
&sortby=`RAND()`
]]
Is there a way to merge or join the MIGX items' output so I can then take just the first 5?
(I hope that makes sense : ) Thanks in advance.
[ed. note: atype last edited this post 12 years, 6 months ago.]