[SOLVED] News Image Issue when No Image Selected In Summary
Posted: Thu Dec 11, 2014 12:57 pm
CMS Made Simple™ 1.11.11 “San Cristobal”
News 2.14.4
CGSmartImage 1.17.1
CGSimpleSmarty 1.7.4
SiteMapMadeSimple 1.2.8
ListIt2 1.4.1
FormBuilder 0.8
I'm having an issue with images in the summary view of the news module, basically image placeholders, or the alt text is appearing when no image is uploaded/selected in the news module on an article. I am hoping the wider CMSMS community have a simple fix to this relatively simple problem I am having trouble with for some reason at the moment. If I have no image selected on any articles then the placeholders/alt text disappear, but it I have just one image selected on one of the articles then the placeholders/alt text appear on every other article!
So the else text... in this instance for now "Text alternative or nothing here if no image chosen" doesn't show on any of the articles that do not have an image attached to them. Basically for the else I don't want anything at all, no image or no text.
News 2.14.4
CGSmartImage 1.17.1
CGSimpleSmarty 1.7.4
SiteMapMadeSimple 1.2.8
ListIt2 1.4.1
FormBuilder 0.8
I'm having an issue with images in the summary view of the news module, basically image placeholders, or the alt text is appearing when no image is uploaded/selected in the news module on an article. I am hoping the wider CMSMS community have a simple fix to this relatively simple problem I am having trouble with for some reason at the moment. If I have no image selected on any articles then the placeholders/alt text disappear, but it I have just one image selected on one of the articles then the placeholders/alt text appear on every other article!
So the else text... in this instance for now "Text alternative or nothing here if no image chosen" doesn't show on any of the articles that do not have an image attached to them. Basically for the else I don't want anything at all, no image or no text.
Code: Select all
<!-- Start News Display Template -->
{if $pagecount > 1}
<p>
{if $pagenumber > 1}
{$firstpage} {$prevpage}
{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber < $pagecount}
{$nextpage} {$lastpage}
{/if}
</p>
{/if}
{foreach from=$items item=entry}
<div class="News_Page">
{cgsi_convert filter_croptofit='170,170,c,1' quality='100'}
{if isset($entry->fields)}
{foreach from=$entry->fields item='field'}
<div class="NewsSummaryField">
{if $field->type == 'file'}
<a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}"><img src="{$entry->file_location}/{$field->value}" alt="News image" /></a>
{else}
Text alternative or nothing here if no image chosen
{/if}
</div>
{/foreach}
{/if}
{/cgsi_convert}
<div class="NewsSummary">
{if $entry->postdate}
<div class="NewsSummaryPostdate">
<p>{$entry->postdate|cms_date_format}</p>
</div>
{/if}
<div class="NewsSummaryLink">
<h2><a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">{$entry->title|cms_escape}</a></h2>
</div>
{if $entry->summary}
<div class="NewsSummarySummary">
<p>{eval var=$entry->summary|strip_tags|summarize:20:"..."}</p>
</div>
<div class="NewsSummaryMorelink">
<p>{$entry->morelink}...</p>
</div>
{else if $entry->content}
<div class="NewsSummaryContent">
<p>{eval var=$entry->content|strip_tags|summarize:20:"…"}</p>
</div>
{/if}
{if isset($entry->extra)}
<div class="NewsSummaryExtra">
{eval var=$entry->extra}
{* {cms_module module='Uploads' mode='simpleurl' upload_id=$entry->extravalue} *}
</div>
{/if}
</div>
</div>
{/foreach}
<!-- End News Display Template -->