Hiding headlines which has summary already??

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
nepsguy
Forum Members
Forum Members
Posts: 17
Joined: Mon Jan 07, 2008 8:44 am

Hiding headlines which has summary already??

Post by nepsguy »

Hello!!

I have problem in news modules, hope picture will make more clear.
Thank you in advance.
Attachments
cms-prob.jpg
cms-prob.jpg (37.8 KiB) Viewed 3647 times
nepsguy
Forum Members
Forum Members
Posts: 17
Joined: Mon Jan 07, 2008 8:44 am

Re: Hiding headlines which has summary already??

Post by nepsguy »

I desperately need to know this please help me out!!! :(
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1974
Joined: Mon Jan 29, 2007 4:47 pm

Re: Hiding headlines which has summary already??

Post by Jo Morg »

We need more info before we can even try to help... ???
How To Submit a Question So You'll Actually Get Help

Where in your templates you call the news tag and how? What's your news template like?.... etc, etc, etc...
"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!
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Hiding headlines which has summary already??

Post by velden »

I guess you call the {news} from your detail template to show the summary below the detail view?

If so:

Assign de news id to a variable somewhere in the detail template:

Code: Select all

{assign var='currentNewsItem' value=$entry->id}
Check for that variable in your summarytemplate:

Code: Select all

{foreach from=$items item=entry}
{if !isset($currentNewsItem) || $currentNewsItem != $entry->id}
 
 //YOUR NORMAL CODE

{/if}
{/foreach}
nepsguy
Forum Members
Forum Members
Posts: 17
Joined: Mon Jan 07, 2008 8:44 am

Re: Hiding headlines which has summary already??

Post by nepsguy »

Jo Morg wrote:We need more info before we can even try to help... ???
How To Submit a Question So You'll Actually Get Help

Where in your templates you call the news tag and how? What's your news template like?.... etc, etc, etc...
Thank you jo! for the reply and sorry for not detail info!!

I am using CMS Made Simple v. 1.11.4 and i want to use it it my news summary template, my current news summary template is like this:
<!-- Start News Display Template -->
{* This section shows a clickable list of your News categories. *}
{* this displays the category name if you're browsing by category *}
{if $category_name}

{/if}

{* if you don't want category browsing on your summary page, remove this line and everything above it *}


{foreach from=$items item=entry}
<div class="articles">
<a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">{$entry->title|cms_escape}</a>
{if $entry->summary}
<div class="NewsSummarySummary">
{eval var=$entry->summary|truncate:335}
</div>

<div class="morelink">
{$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}


</div>
{/foreach}

<!-- End News Display Template -->

and to call news with summary in page this way:

{news summarytemplate="sports" pagelimit=1 category="politics" moretext="read more >>" detailpage="news"}

and to call headlines i am using this template:

<ul>
{foreach from=$items item=entry}
<li><a href='{$entry->moreurl}'
title='{$entry->title|cms_escape:htmlall}'>{$entry->title|cms_escape}</a>
</li>
{/foreach}
</ul>

Thank you.
nepsguy
Forum Members
Forum Members
Posts: 17
Joined: Mon Jan 07, 2008 8:44 am

Re: Hiding headlines which has summary already??

Post by nepsguy »

velden wrote:I guess you call the {news} from your detail template to show the summary below the detail view?

If so:

Assign de news id to a variable somewhere in the detail template:

Code: Select all

{assign var='currentNewsItem' value=$entry->id}
Check for that variable in your summarytemplate:

Code: Select all

{foreach from=$items item=entry}
{if !isset($currentNewsItem) || $currentNewsItem != $entry->id}
 
 //YOUR NORMAL CODE

{/if}
{/foreach}
Thank you velden for reply, still no luck.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Hiding headlines which has summary already??

Post by velden »

I don't understand your goal exactly:

Your calling a summary template to display some items and after that you call the code to display headlines (which I would expect to be called from a summarytemplate).
nepsguy
Forum Members
Forum Members
Posts: 17
Joined: Mon Jan 07, 2008 8:44 am

Re: Hiding headlines which has summary already??

Post by nepsguy »

velden wrote:I don't understand your goal exactly:

Your calling a summary template to display some items and after that you call the code to display headlines (which I would expect to be called from a summarytemplate).
yeah, valden, i have 2 summary templates, one for headlines with news description and other for headlines only (as in attach image), now headline (with description ) also come in headlines, its not looking good coz it get repeat so i want to hide it from headlines.
Hope you get it now. Thank you.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Hiding headlines which has summary already??

Post by velden »

Ok, almost clear.

Apparently you have found a method to distinct between news items that have a news description and items that have not.

I would use the reverse method to find the headline only items.

Further, it might me a little more efficient to combine those in one template/foreach-loop. By capturing and appending the headline-output in a variable and output that at the end. So you can first display the 'news-with-description' and after that the headlines.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1974
Joined: Mon Jan 29, 2007 4:47 pm

Re: Hiding headlines which has summary already??

Post by Jo Morg »

Ok, if I get it correctly you need to make two distinct lists:
  1. All the articles that have summary;
  2. All those that don't have summary;
So, if that is the case, in your headlines template you would do something like

Code: Select all

<ul>
{foreach from=$items item=entry}
{if !$entry->summary}
  <li>
    <a href='{$entry->moreurl}'
title='{$entry->title|cms_escape:htmlall}'>{$entry->title|cms_escape}</a>
  </li>
{/if}
{/foreach}
</ul>
You can also try velden suggestion, but avoid capturing content whenever possible as it is too slow compared to simple assigning tags into variables.
"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!
nepsguy
Forum Members
Forum Members
Posts: 17
Joined: Mon Jan 07, 2008 8:44 am

Re: Hiding headlines which has summary already??

Post by nepsguy »

Jo Morg wrote:Ok, if I get it correctly you need to make two distinct lists:
  1. All the articles that have summary;
  2. All those that don't have summary;
So, if that is the case, in your headlines template you would do something like

Code: Select all

<ul>
{foreach from=$items item=entry}
{if !$entry->summary}
  <li>
    <a href='{$entry->moreurl}'
title='{$entry->title|cms_escape:htmlall}'>{$entry->title|cms_escape}</a>
  </li>
{/if}
{/foreach}
</ul>
You can also try velden suggestion, but avoid capturing content whenever possible as it is too slow compared to simple assigning tags into variables.
Thank you Jo for reply.You mean i should change in headlines template? I changed it but in page headlines disappeared, i am not good in programming as i am designer. So i need more detail.
Thank you in advance.
Post Reply

Return to “The Lounge”