Reputation: 1747
Referrencing non-existing albums in the Gallery component results with the following warning & error:
Warning: Invalid argument supplied for foreach() in
/home/user/domain.com/core/cache/includes/elements/modsnippet/17.include.cache.php on line 106
Fatal error: Cannot use string offset as an array in
/home/user/domain.com/core/cache/includes/elements/modsnippet/17.include.cache.php on line 165
And here is how I reference albums:
[[!Gallery? &album=`[[*alias]]` &limit=`20` &thumbWidth=`90` &thumbHeight=`90`]]
Album names match page's aliases. Everything works fine if albums exist - I would like to display blank album (no content), if no matches found.
Any ideas? I am using MODX Revolution 2.2.4-pl (traditional).
Thanks, Luke
Upvotes: 1
Views: 1085
Reputation: 186
try this:
[[*alias:notempty=`[[!Gallery? &album=`[[*alias]]` &limit=`20` &thumbWidth=`90` &thumbHeight=`90`]]`]]
oh, wait! you are linking [[*alias]]
to your album in Gallery. you should use your own TV like [[*album]]
instead.
Upvotes: 1
Reputation: 1747
Here is how I got it working...
Each page has corresponding gallery created with page's alias as gallery name. Some galleries are left blank.
Luke
Upvotes: 0