samedi 1 août 2015

php if statement to display remove thumbnail

I'm trying to use an if statement so that if the variable isn't set it wil display "noimg.jpg" or no thumbnail, but it isn't doing that at the moment, it's displaying a broken thumbnail.

<?php if ($enclosure = $item->get_enclosure())
    {
    echo '<img src="' . $enclosure->get_link() . '" class="feed-thumb" />';
    }
    else echo'<img src="noimg.jpg">';
    ?>

Aucun commentaire:

Enregistrer un commentaire