Page 1 of 1

Hiding headlines which has summary already??

Posted: Sun Mar 17, 2013 11:51 am
by nepsguy
Hello!!

I have problem in news modules, hope picture will make more clear.
Thank you in advance.

Re: Hiding headlines which has summary already??

Posted: Sun Mar 24, 2013 9:45 am
by nepsguy
I desperately need to know this please help me out!!! :(

Re: Hiding headlines which has summary already??

Posted: Sun Mar 24, 2013 2:30 pm
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...

Re: Hiding headlines which has summary already??

Posted: Sun Mar 24, 2013 5:35 pm
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}

Re: Hiding headlines which has summary already??

Posted: Mon Mar 25, 2013 7:22 am
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.

Re: Hiding headlines which has summary already??

Posted: Mon Mar 25, 2013 7:51 am
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.

Re: Hiding headlines which has summary already??

Posted: Mon Mar 25, 2013 8:15 am
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).

Re: Hiding headlines which has summary already??

Posted: Mon Mar 25, 2013 8:38 am
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.

Re: Hiding headlines which has summary already??

Posted: Mon Mar 25, 2013 9:50 am
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.

Re: Hiding headlines which has summary already??

Posted: Mon Mar 25, 2013 10:16 am
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.

Re: Hiding headlines which has summary already??

Posted: Fri Mar 29, 2013 6:01 am
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.