MODx&;多媒体资料组件-如何处理不存在的相册?
引用Gallery组件中不存在的相册会导致以下警告和错误:MODx&;多媒体资料组件-如何处理不存在的相册?,modx,modx-revolution,Modx,Modx Revolution,引用Gallery组件中不存在的相册会导致以下警告和错误: 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
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
以下是我参考相册的方式:
[[!Gallery? &album=`[[*alias]]` &limit=`20` &thumbWidth=`90` &thumbHeight=`90`]]
相册名称与页面的别名匹配。如果相册存在,一切正常-如果没有找到匹配项,我想显示空白相册(没有内容)
有什么想法吗?我使用的是MODX Revolution 2.2.4-pl(传统)
谢谢,卢克这是我如何让它工作的 每个页面都有相应的库,库名为页面别名。有些画廊是空的
卢克这是我如何让它工作的 每个页面都有相应的库,库名为页面别名。有些画廊是空的 卢克试试这个:
[[*alias:notempty=`[[!Gallery? &album=`[[*alias]]` &limit=`20` &thumbWidth=`90` &thumbHeight=`90`]]`]]
哦,等等!您正在将[[*别名]]
链接到Gallery中的相册。您应该使用自己的电视,如[[*相册]]
。尝试以下方法:
[[*alias:notempty=`[[!Gallery? &album=`[[*alias]]` &limit=`20` &thumbWidth=`90` &thumbHeight=`90`]]`]]
哦,等等!您正在将[[*别名]]
链接到Gallery中的相册。您应该使用自己的电视,如[[*相册]]