Hi,
not sure about the vocabulary.
I'm new to MigX and just spent 10 hours trying to do that.
Thought I would share it here.
First of I have myTemplate which has a migx TV which I will call "myParentMigxTV".
myParentMigxTV
==============
Name : "myParentMigxTV"
Template Access : check "myTemplate"
Input Type : migx
Form Tabs:
[
{"caption":"My Galleries","fields": [
{"field":"title","caption":"Title","inputTVtype":"text"}
{"field":"images","caption":"Upload images","inputTV":"myChildMigxTV.download"},
]}
]
Grid Columns:
[
{"header": "Title", "width": "2", "sortable": "true", "dataIndex": "title"},
{"header": "My Galleries", "width": "2", "sortable": "true", "dataIndex": "images"}
]
I am now able to add a gallery with its title and a bunch a images.
Now let's configure "myChildMigxTV.download".
myChildMigxTV.download
==============
Name : "myChildMigxTV.download"
Template Access : none
Input Type : migx
Configurations : "file.download"
Now we must create the configuration file. this Link will help you do so
http://rtfm.modx.com/extras/revo/migx/migx.tutorials/migx.use-resource-specific-mediasource-and-multifile-uploader.
Upload some sample images.
Now let's do the front end.
Insert in myTemplate the following shortcode:
[[!getImageList?
&tvname=`myParentMigxTV`
&tpl=`myParentMigxTemplate`
&processTVs=`0`
]]
myParentMigxTemplate.chunk :
<div class="myGallery">
<h1>[[+title]]</h2>
<ul>
[[!parseMIGXToGallery? &tpl=`myMigxImageGallery.template` &input=`[[+images]]`]]
</ul>
</div>
Now let's create the parseMIGXToGallery snippet (you can find the original code there :
https://www.markhamstra.com/modx/2012/04/managing-galleries-with-migx/ ) :
parseMIGXToGallery
<?php
$input = $modx->fromJSON($input);
$output = array();
//if (!$input || empty($tpl)) return 'no stuff';
foreach ($input as $row) {
$output[] = $modx->getChunk($tpl, $row);
}
return implode("\n", $output);
And now the corresponding chunk:
myMigxImageGallery.template
<li>
[[migxResourceMediaPath? &pathTpl=`assets/gallery/{id}_{alias}/`]][[+image]]
</li>
I let you do the html for displaying the image.
"[[migxResourceMediaPath? &pathTpl=`assets/gallery/{id}_{alias}/`]]" is the path where your images are uploaded (see
http://rtfm.modx.com/extras/revo/migx/migx.tutorials/migx.use-resource-specific-mediasource-and-multifile-uploader for more inforamtions)
that's it.
I ended up with this solution because i was having torubles with calling getImageList within a chunk that was already called by getImageList.
[ed. note: robotpapier last edited this post 11 years, 11 months ago.]