attribute - if statement php help..
Permalink 1 user found helpful
Hi chaps,
Quick bit of php help needed if possible.. I'm using the following code to pull the background image of a div from an attribute called background:
All is working perfectly, but how could I add an 'if' statement so when there is no background image selected through the C5 properties it uses a default image that I can just link to within my theme/images folder. So I'm basically wanting it to say 'if background attribute is empty use images/myimage.jpeg'. Can any php guru's give me a hand?
Thanks for any help!
Quick bit of php help needed if possible.. I'm using the following code to pull the background image of a div from an attribute called background:
<div id="MyDivExample" style="background: url(<?php echo($c->getAttribute('background')->getVersion()->getRelativePath());?>) no-repeat bottom center">
All is working perfectly, but how could I add an 'if' statement so when there is no background image selected through the C5 properties it uses a default image that I can just link to within my theme/images folder. So I'm basically wanting it to say 'if background attribute is empty use images/myimage.jpeg'. Can any php guru's give me a hand?
Thanks for any help!