Image/File Attribute returning error when blank
Permalink 1 user found helpful
Hi Guys,
I'm using the Image/File Attribute and if no image is selected it will return the following error
--------------
Fatal error: Call to a member function getVersion() on a non-object in /home/content/w/a/l/walkatjurraorg/html/themes/walkatjurra/elements/header.php on line 26
---------------
And this is what's on line 26
<img src="<?php echo($c->getAttribute('page_bg')->getVersion()->getRelativePath());?>" />
Basically, it seems that if the field/attribute is not populated it will return the error because on another page where an image was loaded it works fine.
My question, is it possible to have it both populate or not, and what would the code be like.
Thanks & Regards
Said
I'm using the Image/File Attribute and if no image is selected it will return the following error
--------------
Fatal error: Call to a member function getVersion() on a non-object in /home/content/w/a/l/walkatjurraorg/html/themes/walkatjurra/elements/header.php on line 26
---------------
And this is what's on line 26
<img src="<?php echo($c->getAttribute('page_bg')->getVersion()->getRelativePath());?>" />
Basically, it seems that if the field/attribute is not populated it will return the error because on another page where an image was loaded it works fine.
My question, is it possible to have it both populate or not, and what would the code be like.
Thanks & Regards
Said