Hi everyone. This has been driving me crazy for several hours now, and I was hoping someone could shed some light on this for me...
First, I'm running MODX 2.3.1-pl, PHP 5.5.9, Nginx 1.4.6, Ubuntu 14.04
I want to set up a site that contains multiple galleries, and MIGX seems like the right tool for this job. I followed the tutorial at
http://rtfm.modx.com/extras/revo/migxdb/migxdb.tutorials/migxdb.create-a-basic-gallery-management-from-scratch-with-migxdb and everything seemed to be going great! That is, until I started trying to output gallery contents.
Basically, migx, migxLoopCollection, and getImageList all output different things. Very different things. Let me show you.
I'm testing with two galleries, each with two images. I'm using this simple chunk for gallery entries, galleryChunk:
<img src='[[+image:phpthumbof=`w=180&h=140`]]'/>
The HTML I've put into MODX looks like this:
<p>migx:</p>
[[!migx? &tvname=`Mygallery` &tpl=`galleryChunk` &docid=`[[*id]]`]]
<p>getImageList:</p>
[[!getImageList? &tvname=`Mygallery` &tpl=`galleryChunk` &docid=`[[*id]]`]]
<p>migxLoopCollection w/o template:</p>
[[!migxLoopCollection?
&packageName=`mygallery`
&classname=`myGallery`
&sortConfig=`[{"sortby":"pos","sortdir":"ASC"}]`
&where=`{"resource_id":"[[*id]]","published":"1"}`
]]
<p>migxLoopCollection w/template:</p>
[[!migxLoopCollection?
&packageName=`mygallery`
&classname=`myGallery`
&sortConfig=`[{"sortby":"pos","sortdir":"ASC"}]`
&where=`{"resource_id":"[[*id]]","published":"1"}`
&tpl=`galleryChunk`
]]
The output looks like this (I've replaced the actual images with notes in [square brackets]):
migx:
[Image from this gallery] [Other image from this gallery]
getImageList:
migxLoopCollection w/o template:
Array
(
[id] => 3
[title] => UFO
[description] => A friggin UFO!
[resource_id] => 3
[resource_ids] =>
[image] => assets/Fig-1-Cutaway.jpg
[extended] => Array
(
[url] => http://example.com
)
[pos] => 10
[published] => 1
[createdby] => 1
[createdon] => 2014-08-31 16:36:56
[editedby] => 1
[editedon] => 2014-08-31 20:30:41
[deleted] => 0
[deletedon] => -1-11-30 00:00:00
[deletedby] => 0
[publishedon] => 2014-08-31 16:36:56
[publishedby] => 1
[_alt] => 0
[_first] => 1
[_last] =>
[idx] => 1
[property.packageName] => mygallery
[property.classname] => myGallery
[property.sortConfig] => [{"sortby":"pos","sortdir":"ASC"}]
[property.where] => {"resource_id":"3","published":"1"}
)
Array
(
[id] => 4
[title] => Poster
[description] => An inspiring poster
[resource_id] => 3
[resource_ids] =>
[image] => assets/holstee1.jpg
[extended] => Array
(
[url] => http://example.com
)
[pos] => 20
[published] => 1
[createdby] => 1
[createdon] => 2014-08-31 16:37:24
[editedby] => 1
[editedon] => 2014-08-31 20:30:55
[deleted] => 0
[deletedon] => -1-11-30 00:00:00
[deletedby] => 0
[publishedon] => 2014-08-31 16:37:24
[publishedby] => 1
[_alt] => 1
[_first] =>
[_last] =>
[idx] => 2
[property.packageName] => mygallery
[property.classname] => myGallery
[property.sortConfig] => [{"sortby":"pos","sortdir":"ASC"}]
[property.where] => {"resource_id":"3","published":"1"}
)
migxLoopCollection w/template:
[Image from other gallery] [Other image from other gallery] [Image from this gallery] [Other image from this gallery]
So the migx snippet seems to be working fine, hooray!
The getImageList snippet list doesn't output anything. In fact, I've never been able to get it to output anything EVER. I've traced that down a little. It appears the line
$outputvalue = empty($outputvalue) ? $tv->renderOutput($docid) : $outputvalue;
calls renderOutput, which returns an empty string. Shortly below this, we execute
if (empty($outputvalue)) {
return '';
}
and return an empty string, just like I see in the output.
migxLoopCollection without a template parameter seems to be working. The output is just a print_r of the gallery's MIGX TV, but at least it's outputting the two gallery items.
migxLoopCollection with a template is odd. It uses the template to render gallery items correctly, but it renders ALL items from ALL galleries!
I've been tearing my hair out over this. I see a lot of people are using getImageList instead of migx or migxLoopCollection, but I've never been able to get it to work.
What am I doing wrong? Is there any information I can give you to help figure that out? Help me, please!
Thanks,
-g.