Show other news summary than opened news item

General project discussion. NOT for help questions.
Post Reply
flmm
Forum Members
Forum Members
Posts: 41
Joined: Wed Mar 24, 2010 1:12 pm

Show other news summary than opened news item

Post by flmm »

I have a problem with the news module that when a news item is opened I would like to show the other news items in a summary under the main news item. But when I trie to do that I also see the news item I just opened in the summary of news items.

Is there a way to only show other news items in a summary?

I open the full news item in the {content} of the same page now.

Thanks for your help.
Peciura

Re: Show other news summary than opened news item

Post by Peciura »

Basic idea is not to summary of article that is opened, So if you want to show 4 summaries there will be only 3. Further adjustment have to be done to show 4 articles. Follow steps:

1. Add this line to News detail template. It we will use it to recognize what news article is opened.
{assign var='current_news_id' value=$entry->id}
2. Modify appropriate  News summary template to exclude article that is being viewed (i guess it you are news summaries somewhere in page template).
   {foreach from=$items item=entry}
   {if $current_news_id != $entry->id}

      ...{* your summary template *}

   {/if}
{/foreach}

3. Modify page template to display news summary according variable {$current_news_id}. It is important to generate page content before displaying news summary. Content is saved to variable {$new_content}
{content assign='new_content'}
   {if !empty($current_news_id)}
      {news number='4'  lang='lt_LT' summarytemplate='small_summary' }
   {else}
      {news number='5'  lang='lt_LT' summarytemplate='small_summary' }
   {/if}
...
{$new_content} {*put content to its normal position*}
...
That's about it. I if it does not work attach templates:  page, news summary and news  detail to your new message and post link  page.
Post Reply

Return to “General Discussion”