it is a part of a bigger loop that iterates through a bunch of articles.
If $entry->fields is empty it should get an image from {$entry->file_location}
If $entry->fields is still empty after that the code should look for image in the content.
and if there is no image still showing it should display the <img src="uploads/images/img-01.jpg" class="img-responsive"/>
The problem is when the code looks like it does below the "<img src="uploads/images/img-01.jpg" class="img-responsive"/>"
is the only image being displayed.
but if I use " !empty " for the {if} and {elseif} the "<img src="uploads/images/img-01.jpg" class="img-responsive"/>" in the {else} is never displayed
can someone help me out here?
Code: Select all
{if empty($entry->fields)}
<figure>
{foreach from=$entry->fields item='field'}
{if $field->type == 'file'}
{if isset($field->value) && $field->value}
<img src="{$entry->file_location}/{$field->value}" class="img-responsive"/>
{/if}
{/if}
{/foreach}
</figure>
{elseif empty($entry->fields)}
<figure>
{cgsi_getimages assign='imageinfo' nocontent=1}{$entry->content}{/cgsi_getimages}
{foreach from=$imageinfo item=image name=pic}
{if $smarty.foreach.pic.first}<img src="{$image.src}" class="img-responsive"/>{/if}
{/foreach}
</figure>
{else}
<figure>
<img src="uploads/images/img-01.jpg" class="img-responsive"/>
</figure>
{/if}