Problem showing nodes when not all medias are picked
Hi!
My intention is to create a list of news, and there will be attached a thumbnail (news_teaserimage) to some of the news. The problem is that if I only pick medias in some of the nodes, I get an xslt-error, and no code will be generated. If i pick medias in all nodes, then it works.. The intention is that the code will gererate the nodes no matter if there are an image or not. If there is no image picked then it won't be displayed.
This happens because the $media variable is created regardless of the news_teaserimage having any content, and because the if test only tests the existence of the news_teaserimage, instead of testing its contents. If you move the media variable inside of the if, and re-phrase the if to test for actual content it should work:
Problem showing nodes when not all medias are picked
Hi!
My intention is to create a list of news, and there will be attached a thumbnail (news_teaserimage) to some of the news. The problem is that if I only pick medias in some of the nodes, I get an xslt-error, and no code will be generated. If i pick medias in all nodes, then it works.. The intention is that the code will gererate the nodes no matter if there are an image or not. If there is no image picked then it won't be displayed.
What am I doing wrong?
- Casper
Hi Casper,
This happens because the $media variable is created regardless of the news_teaserimage having any content, and because the if test only tests the existence of the news_teaserimage, instead of testing its contents. If you move the media variable inside of the if, and re-phrase the if to test for actual content it should work:
/Chriztian
Hello Chriztian,
Thank you very much for your respons. It works perfectly! :D
Thanks for your time,
Casper
is working on a reply...