News Module - missing More link image

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
TFcroft4
Forum Members
Forum Members
Posts: 27
Joined: Thu Nov 15, 2007 5:23 pm

News Module - missing More link image

Post 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.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: News Module - missing More link image

Post by Jo Morg »

You will have to post the News summary template here... something in the template logic seems to be wrong.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
TFcroft4
Forum Members
Forum Members
Posts: 27
Joined: Thu Nov 15, 2007 5:23 pm

Re: News Module - missing More link image

Post 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 -->
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: News Module - missing More link image

Post 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}
(...)
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
TFcroft4
Forum Members
Forum Members
Posts: 27
Joined: Thu Nov 15, 2007 5:23 pm

Re: News Module - missing More link image

Post 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
TFcroft4
Forum Members
Forum Members
Posts: 27
Joined: Thu Nov 15, 2007 5:23 pm

Re: News Module - missing More link image

Post 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
Post Reply

Return to “CMSMS Core”