When checking with the OR operator (||) the code will execute if one or none of them is empty. But you echo both variables even if one of them is empty.
What I think you want to do is use the AND operator(&&). This way, the code will only execute if none of the variables are empty.
<?php if(!empty($this->element->videos) && !empty($this->element->productdownloads)) {
echo $this->element->videos;
echo $this->element->productdownloads; }
?>
if you still want to show videos, even if productdownloads is empty (and vice versa), you could do a seperate if for each of them, like this:
if(!empty($this->element->videos){
echo $this->element->videos;
}
if(!empty($this->element->productdownloads){
echo $this->element->productdownloads;
}
edit: minor grammatical fixes
!empty($this->element->videos) || !empty($this->element->productdownloads)$this->element->videos || $this->element->productdownloadsfirst. This evaluates to a boolean value no matter what those variables actually contain. If one of them has some value, this will probably evaluate to true. And doing!empty()on a booleantruewill returntrue. But as Jay Blanchard pointed out,empty()only works on variables so you probably have an error.!empty()on each variable separately. Soif(!empty($this->element->videos) || !empty($this->element->productdownloads)). But that will try to echo both values even if just one of them has something. So you probably want to use AND&&instead of OR||