This is a great module!

I'm having a problem using the advanced dynamic display. I've set up a view to show images related to the current node. The node contains a nodereference field pointing to nodes containing the images (stored as CCK imagefields). The view is set to take the current node ID as an argument.

In the Views maintenance screen, I can see that the view is working correctly. If a node has images attached, the dd block shows the images as expected. However, when I go to individual nodes, the dd block presents an error if there are no images attached to the node. The errors are:

* warning: asort() expects parameter 1 to be array, null given in /home/.salon/childrensong/staging.childrensong.org/sites/all/modules/ddblock/ddblock.module on line 1501.
* warning: Invalid argument supplied for foreach() in /home/.salon/childrensong/staging.childrensong.org/sites/all/themes/newsflash/template.php on line 232.
* warning: Invalid argument supplied for foreach() in /home/.salon/childrensong/staging.childrensong.org/sites/all/themes/newsflash/template.php on line 168.
* warning: Invalid argument supplied for foreach() in /home/.salon/childrensong/staging.childrensong.org/sites/all/themes/newsflash/custom/modules/ddblock/ddblock-cycle-block-content-upright40new.tpl.php on line 47.

It doesn't seem to be detecting that the view is empty and tries to display content regardless. Any suggestions on how to have the block disappear gracefully when a view is empty?

You can see examples of it working correctly at http://staging.childrensong.org/news/2005_02_19_la_boheme.htm and with the error at http://staging.childrensong.org/2009_02_08_songfest_09.htm

Comments

elally’s picture

Correction: link for the error-laden page is http://staging.childrensong.org/news

ppblaauw’s picture

Thanks for reporting

This patch should prevent showing errors if a view used for the dynamic display block module has no content.

Please let me know if this works.

Edit: please use the patch in #4

elally’s picture

Status: Active » Needs review

Thanks for the patch. I applied it and cleared caches.

It fixed the first error in asort() but the other ones are still coming up. The two errors in template.php are in the two pre-processor functions.

ppblaauw’s picture

Thanks for reviewing the patch.

Also the theme functions should not be called if the content is empty.

The following patch should solve the issue.

Please let me know if this works.

elally’s picture

Thanks for the updated patch -- worked perfectly!

ppblaauw’s picture

Status: Needs review » Closed (fixed)

Closing the issue. Patch applied in RC6.