News module not showing "read more" button
News module not showing "read more" button
I have a problem across all seven websites I run with CMS Made Simple. Sometimes, though not always, the news blurb cuts off at a URL and doesn't show the "read more" button. I can't figure out why and I can't replicate it consistently across all sites.
For example, on this page (http://www.hmmsvt.com/) the first two news items are missing the "read more" button. Both cut off at a URL.
However, if you go here (http://www.oqsvt.com/) you'll see the first news item is the same as the second on the page above (literally copy/pasted), but on this site the "read more" button appears.
What am I missing??
Thanks,
Tessa
For example, on this page (http://www.hmmsvt.com/) the first two news items are missing the "read more" button. Both cut off at a URL.
However, if you go here (http://www.oqsvt.com/) you'll see the first news item is the same as the second on the page above (literally copy/pasted), but on this site the "read more" button appears.
What am I missing??
Thanks,
Tessa
Re: News module not showing "read more" button
You're probably using the 'summarize' modifier inside the News summary template.
That cuts of the url at the specified position which renders an invalid html output.
That cuts of the url at the specified position which renders an invalid html output.
Re: News module not showing "read more" button
Could you tell me more? What do I need to change to prevent that?
Here is the text from my News:Summary template:
Here is the text from my News:Summary template:
Code: Select all
<!-- Start News Display Template -->
{* This section shows a clickable list of your News categories. *}
<ul class="list1">
{foreach from=$cats item=node}
{if $node.depth > $node.prevdepth}
{repeat string="<ul>" times=$node.depth-$node.prevdepth}
{elseif $node.depth < $node.prevdepth}
{repeat string="</li></ul>" times=$node.prevdepth-$node.depth}
</li>
{elseif $node.index > 0}</li>
{/if}
<li{if $node.index == 0} class="firstnewscat"{/if}>
{if $node.count > 0}
<a href="{$node.url}">{$node.news_category_name}</a>{else}<span>{$node.news_category_name} </span>{/if}
{/foreach}
{repeat string="</li></ul>" times=$node.depth-1}</li>
</ul>
{* this displays the category name if you're browsing by category *}
{if $category_name}
<h1>{$category_name}</h1>
{/if}
{* if you don't want category browsing on your summary page, remove this line and everything above it *}
{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="NewsSummary">
{if $entry->postdate}
<div class="NewsSummaryPostdate">
{$entry->postdate|cms_date_format}
</div>
{/if}
<div class="NewsSummaryLink">
<a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">{$entry->title|cms_escape}</a>
</div>
<div class="NewsSummaryCategory">
{$category_label} {$entry->category}
</div>
{if $entry->author}
<div class="NewsSummaryAuthor">
{$author_label} {$entry->author}
</div>
{/if}
{if $entry->summary}
{* note, for security purposes, incase News articles can come from untrused sources, we do not pass the summary or content through smarty in the default templates *}
<div class="NewsSummarySummary">
{$entry->summary}
</div>
<div class="NewsSummaryMorelink">
[{$entry->morelink}]
</div>
{else if $entry->content}
{* note, for security purposes, incase News articles can come from untrused sources, we do not pass the summary or content through smarty in the default templates *}
<div class="NewsSummaryContent">
{$entry->content}
</div>
{/if}
{if isset($entry->extra)}
<div class="NewsSummaryExtra">
{$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'}
{if isset($field->value) && $field->value}
<img src="{$entry->file_location}/{$field->value}"/>
{/if}
{elseif $field->type == 'linkedfile'}
{* also assume it's an image... *}
{if !empty($field->value)}
<img src="{file_url file=$field->value}" alt="{$field->value}"/>
{/if}
{else}
{$field->name}: {$field->value}
{/if}
</div>
{/foreach}
{/if}
</div>
{/foreach}
<!-- End News Display Template -->
Last edited by velden on Sun Aug 16, 2020 7:04 pm, edited 1 time in total.
Reason: Added code tags for readability
Reason: Added code tags for readability
Re: News module not showing "read more" button
This is not the template used to display the News on the page you pointed too. E.g the very first comment line is missing in the page source.
Note that CMSMS has an Admin Search function (under Extensions iirc). Try to search for 'summarize' and see if a News template pops up in the search results.
Code: Select all
<!-- Start News Display Template -->Note that CMSMS has an Admin Search function (under Extensions iirc). Try to search for 'summarize' and see if a News template pops up in the search results.
Re: News module not showing "read more" button
Interesting. Here's a screenshot of that page. Obviously I'm missing something. I'll go look through the Admin Search function. Thanks.
Re: News module not showing "read more" button
What your are showing is the prototype template. That is the template that comes by default with an install. It will also be used as a start when you create a new template which you then can modify.
Look at the templates on the 'Templates' tab. Make sure at the top no filter is applied (or the filter should be set to News:Summary in this case).
Find the template(s) of Type 'News:Summary' and have a look at their code. There's one default template per Type (which has the green check mark in the 'Default' column). But it's possible the default is overridden from the {news summarytemplate=...} tag
Look at the templates on the 'Templates' tab. Make sure at the top no filter is applied (or the filter should be set to News:Summary in this case).
Find the template(s) of Type 'News:Summary' and have a look at their code. There's one default template per Type (which has the green check mark in the 'Default' column). But it's possible the default is overridden from the {news summarytemplate=...} tag
Re: News module not showing "read more" button
Ok, I don't know what was going on with my Summary page. I hit the "Reset to Factory Defaults" and the code changed, but the front end looks the same. I don't see any summarizer function in there. Am I missing it? (http://www.hmmsvt.com/)
Code: Select all
<!-- Start News Display Template -->
{* This section shows a clickable list of your News categories. *}
<ul class="list1">
{foreach from=$cats item=node}
{if $node.depth > $node.prevdepth}
{repeat string="<ul>" times=$node.depth-$node.prevdepth}
{elseif $node.depth < $node.prevdepth}
{repeat string="</li></ul>" times=$node.prevdepth-$node.depth}
</li>
{elseif $node.index > 0}</li>
{/if}
<li{if $node.index == 0} class="firstnewscat"{/if}>
{if $node.count > 0}
<a href="{$node.url}">{$node.news_category_name}</a>{else}<span>{$node.news_category_name} </span>{/if}
{/foreach}
{repeat string="</li></ul>" times=$node.depth-1}</li>
</ul>
{* this displays the category name if you're browsing by category *}
{if $category_name}
<h1>{$category_name}</h1>
{/if}
{* if you don't want category browsing on your summary page, remove this line and everything above it *}
{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="NewsSummary">
{if $entry->postdate}
<div class="NewsSummaryPostdate">
{$entry->postdate|cms_date_format}
</div>
{/if}
<div class="NewsSummaryLink">
<a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">{$entry->title|cms_escape}</a>
</div>
<div class="NewsSummaryCategory">
{$category_label} {$entry->category}
</div>
{if $entry->author}
<div class="NewsSummaryAuthor">
{$author_label} {$entry->author}
</div>
{/if}
{if $entry->summary}
{* note, for security purposes, incase News articles can come from untrused sources, we do not pass the summary or content through smarty in the default templates *}
<div class="NewsSummarySummary">
{$entry->summary}
</div>
<div class="NewsSummaryMorelink">
[{$entry->morelink}]
</div>
{else if $entry->content}
{* note, for security purposes, incase News articles can come from untrused sources, we do not pass the summary or content through smarty in the default templates *}
<div class="NewsSummaryContent">
{$entry->content}
</div>
{/if}
{if isset($entry->extra)}
<div class="NewsSummaryExtra">
{$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'}
{if isset($field->value) && $field->value}
<img src="{$entry->file_location}/{$field->value}"/>
{/if}
{elseif $field->type == 'linkedfile'}
{* also assume it's an image... *}
{if !empty($field->value)}
<img src="{file_url file=$field->value}" alt="{$field->value}"/>
{/if}
{else}
{$field->name}: {$field->value}
{/if}
</div>
{/foreach}
{/if}
</div>
{/foreach}
<!-- End News Display Template -->
Last edited by velden on Sat Aug 22, 2020 9:09 am, edited 1 time in total.
Reason: Added code tags for readability
Reason: Added code tags for readability
Re: News module not showing "read more" button
Then you should find how and where News is included on the page.
This can be inside a content block (where you edit the page) or it can be in the page template of that page.
Search for the {news ....} tag and check if it has a summarytemplate parameter.
The value of that parameter is the name of the template you're looking for. If it doesn't have that parameter it means the default News summary template is used.
In the image below you can see multiple News summary templates can exist but only one is the default.
Please note that the Type column shows you the type of the template. Don't get distracted by the Name of the template.
It is possible that file based templates are used which do not show up in Design Manager, but it isn't very common yet. Again, the {news ...} tag and it's parameters should help determining that.
This can be inside a content block (where you edit the page) or it can be in the page template of that page.
Search for the {news ....} tag and check if it has a summarytemplate parameter.
The value of that parameter is the name of the template you're looking for. If it doesn't have that parameter it means the default News summary template is used.
In the image below you can see multiple News summary templates can exist but only one is the default.
Please note that the Type column shows you the type of the template. Don't get distracted by the Name of the template.
It is possible that file based templates are used which do not show up in Design Manager, but it isn't very common yet. Again, the {news ...} tag and it's parameters should help determining that.
Re: News module not showing "read more" button
Ok, I think we are making progress and thank you for sticking with me on this!! I was not using the summarytemplate parameter, but I wanted it to use the default template anyway. I added in the parameter now, just so there's no confusion. Here is the News::Summary code. I see where it truncates after 350 characters. Do I want to change that?
Code: Select all
<div class="newswrapper">
{foreach from=$items item=entry}
{assign var=post value=$entry->id}
{assign var=img value=$entry->fieldsbyname.featured->value}
{if isset($entry->fieldsbyname.featured->value)}
<div class="NewsSummary">
<h3><a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">{$entry->title|cms_escape:htmlall}</a></h3>
<span class="imageThumb">{cms_module module="CGSmartImage" src="uploads/news/id$post/$img" width="80" protect=false}</span>
{if $entry->summary}{eval var=$entry->summary}
<p>
<a class="button blue" href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">Read more</a></p>
{else if $entry->content}{eval var=$entry->content|truncate:350:"...":true|strip_tags}</br>
<p>
<a class="button blue" href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">Read more</a></p>
{/if}
{else}
<div class="NewsSummary">
<h3><a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">{$entry->title|cms_escape:htmlall}</a></h3>
{if $entry->summary}{eval var=$entry->summary}<p>
<a class="button blue" href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">Read more</a></p>
{else if $entry->content}{eval var=$entry->content|truncate:350:"...":true|strip_tags}</br>
<p>
<a class="button blue" href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">Read more</a></p>
{/if}
{/if}
</div>
{/foreach}
<div class="NewsMore">
<p>
<a class="button maroon" href="/news" >Want More News?</a>
</div>
</div>
Last edited by velden on Sat Aug 22, 2020 9:57 pm, edited 1 time in total.
Reason: Added code tags for readability
Reason: Added code tags for readability
Re: News module not showing "read more" button
Ok, my bad.
Truncate modifier in stead of summarize.
Anyway, the order in which the modifiers are applied is wrong I guess. It's not smart to first truncate and then strip tags from what's left.
I'd suggest to try:
Truncate modifier in stead of summarize.
Anyway, the order in which the modifiers are applied is wrong I guess. It's not smart to first truncate and then strip tags from what's left.
I'd suggest to try:
Code: Select all
{eval var=$entry->content|strip_tags|truncate:350:"...":true}Re: News module not showing "read more" button
Woo hoo!! That's it. You're awesome! THANK YOU!!


