B
B
bbaggins2016-10-11 16:36:43
PHP
bbaggins, 2016-10-11 16:36:43

How to display a tag instead of an image in Joomla 3?

Friends, hello everyone!
Tell me how to be, I display the image of the material:

<div class="img" style="background-image: url(/media/k2/items/cache/'.md5("Image".$item->id).'_S.jpg);">

But it happens that there is no image, and it is necessary to display the name of the material in this place. You need to somehow set the variable check, but the problem is that K2 drags the image from the cache.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory S., 2016-10-11
@bbaggins

if (file_exist('/media/k2/items/cache/'.md5("Image".$item->id).'_S.jpg')) {
    echo '<div class="img" style="background-image: url(....)">';
} else {
    echo '<h1>Title</h1>'
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question