Page 1 of 1

News Module - missing More link image

Posted: Mon Feb 20, 2017 9:06 am
by TFcroft4
On my site http://www.finchhouse.org I have the Newsmodule. On the Newspage a graphic for MORE is listed in the generated HTML but does not appear. The generated html points to a folder although I would have expected it to point to a graphic.

Looking at the HTML I see:

Code: Select all

 
	<div class="NewsSummaryMorelink">
		[<a href="http://www.finchhouse.org/finchhouse/index.php?mact=News,cntnt01,detail,0&cntnt01articleid=26&cntnt01returnid=64">More</a>]
	</div>
<div class="NewsSummaryField">
                  <img src="http://www.finchhouse.org/finchhouse/uploads/news/id26/" />
             </div>
The site is using CMSMS 2,1,6

The site sits one folder below the public_html folder on my shared server. ( I have other sites in separate folders as well)

I suspect a bit more investigation or data may be needed to resolve this. Any guidance would be welcomed.

Re: News Module - missing More link image

Posted: Mon Feb 20, 2017 12:21 pm
by Jo Morg
You will have to post the News summary template here... something in the template logic seems to be wrong.

Re: News Module - missing More link image

Posted: Mon Feb 20, 2017 2:05 pm
by TFcroft4
jo - this is the New Normal Template:

Code: Select all

<!-- Start News Display Template -->
{if $pagecount > 1}
  <p>
{if $pagenumber > 1}
{$firstpage}&nbsp;{$prevpage}&nbsp;
{/if}
{$pagetext}&nbsp;{$pagenumber}&nbsp;{$oftext}&nbsp;{$pagecount}
{if $pagenumber < $pagecount}
&nbsp;{$nextpage}&nbsp;{$lastpage}
{/if}
</p>
{/if}
{foreach from=$items item=entry}
<div class="NewsSummary">

{if $entry->formatpostdate}
	<div class="NewsSummaryPostdate">
		{$entry->formatpostdate}
	</div>
{/if}

<div class="NewsSummaryLink">
	{$entry->titlelink}
</div>

<div class="NewsSummaryCategory">
	{$category_label} {$entry->category}
</div>

{if $entry->author}
	<div class="NewsSummaryAuthor">
		{$author_label} {$entry->author}
	</div>
{/if}

{if $entry->summary}
	<div class="NewsSummarySummary">
		{eval var=$entry->summary}
	</div>

	<div class="NewsSummaryMorelink">
		[{$entry->morelink}]
	</div>

{else if $entry->content}

	<div class="NewsSummaryContent">
		{eval var=$entry->content}
	</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}
{if isset($entry->fields)}
  {foreach from=$entry->fields item='field'}
     <div class="NewsSummaryField">
        {if $field->type == 'file'}
          <img src="{$entry->file_location}/{$field->value}"/>
        {else}
          {$field->name}:&nbsp;{eval var=$field->value}
        {/if}
     </div>
  {/foreach}
{/if}

</div>
{/foreach}
<!-- End News Display Template -->

Re: News Module - missing More link image

Posted: Mon Feb 20, 2017 2:38 pm
by Jo Morg
The only thing I can say from that is that {$field->value} is empty and
<img src="{$entry->file_location}/{$field->value}"/> is only showing {$entry->file_location}/ as the image source. The only reason I can think of is that no value has been given to that particular field. You'll have to verify that on each news entry... or if you just want to hide it in case it's empty use something along the lines of:

Code: Select all

(...)
{if !empty($field->value)}
     <div class="NewsSummaryField">
        {if $field->type == 'file'}
          <img src="{$entry->file_location}/{$field->value}"/>
        {else}
          {$field->name}:&nbsp;{eval var=$field->value}
        {/if}
     </div>
{/if}
(...)

Re: News Module - missing More link image

Posted: Mon Feb 20, 2017 3:15 pm
by TFcroft4
Jo
Thanks for the tip - the data is quite old ( and has been subject to a number of updates) so I will go through the old posts and also try a new News item to see if a new item has the same issue.
Ted

Re: News Module - missing More link image

Posted: Mon Feb 20, 2017 4:38 pm
by TFcroft4
Jo
Update
The News module on my system has a custom field Image of type file.
Not all News items have images but CMSMS still looks for and in these cases can not find the image file - hence the eroneous image on the rendered page.

I copied the default template and edited as below to so that if attribute has a value then it is used to generate the link. (it does not test that the link actually exists though.

Code: Select all

        {if $field->type == 'file'}
	  {* this template assumes that every file uploaded is an image of some sort, because News doesn't distinguish *}
          {if !empty($field->value)} 
              <img src="{$entry->file_location}/{$field->value}"/>
          {/if}
        {else}
          {$field->name}:&nbsp;{eval var=$field->value}
        {/if}
This seems to work.

Ted