Page 1 of 1

[solved] One (summary) news on each page

Posted: Thu Nov 15, 2007 7:59 am
by Badyl
Hello

I think what can I do, to get one news (the newest news) on each page.

I tried to mixed which the news template - summary and detail, and nothing.

To summary template I added code from detail template

Code: Select all

{if $entry->summary}
	<div id="NewsPostDetailSummary">
		<strong>
			{eval var=$entry->summary}
		</strong>
	</div>
{/if}
Have You any sollution for this :) ?

Re: One (summary) news on each page

Posted: Thu Nov 15, 2007 8:32 am
by RonnyK
Why don't you call {news number='1'} from within your template. That way you have a single entry on every page opened, as it is part of the template.

Ronny

Re: One (summary) news on each page

Posted: Thu Nov 15, 2007 8:58 am
by Badyl
Yes but then i have been short news with link to full version of this news

And i want to display only the full version of news directly on page.

Re: One (summary) news on each page

Posted: Thu Nov 15, 2007 9:02 am
by RonnyK
What happens if you create a summary-template, where the part in RED is deleted....
{if $entry->summary}

{eval var=$entry->summary}



[{$entry->morelink}]


{else
if $entry->content}


{eval var=$entry->content}

{/if}
Ronny

Re: One (summary) news on each page

Posted: Thu Nov 15, 2007 9:26 am
by Badyl
I have a blank page if i copy to summary template Your's code (without the Red part)

and get

Code: Select all

{news number='1' category="Kryminalki" summarytemplate="template2"}

Re: One (summary) news on each page

Posted: Thu Nov 15, 2007 9:36 am
by RonnyK
Works over here,

http://demo.krijt.eu/index.php?page=nnn

I'll post my template:

{foreach from=$items item=entry}


{if $entry->formatpostdate}

{$entry->formatpostdate}

{/if}


{$entry->titlelink}



{$category_label} {$entry->category}


{if $entry->author}

{$author_label} {$entry->author}

{/if}

{if $entry->content}


{eval var=$entry->content}

{/if}

{if isset($entry->extra)}
   
        {eval var=$entry->extra}
{* {cms_module module='Uploads' mode='simpleurl' upload_id=$entry->extravalue} *}
   
{/if}
{if isset($entry->fields)}
  {foreach from=$entry->fields item='field'}
   
        {if $field->type == 'file'}
          file_location}/{$field->value}/>
        {else}
          {$field->name}: {eval var=$field->value}
        {/if}
   
  {/foreach}
{/if}


{/foreach}

with calling:
{news summarytemplate="check" number="1"}
Ronny

Re: One (summary) news on each page

Posted: Thu Nov 15, 2007 9:40 am
by RonnyK
When you dont want to show the author and category, you can delete:

  {$category_label} {$entry->category}


{if $entry->author}
 
      {$author_label} {$entry->author}
 
{/if}
from the template.

Changing

  {$entry->titlelink}
to

  {$entry->title}
makes no LINK to dive into the entry, otherwise people can dive into ....

Ronny

Re: One (summary) news on each page

Posted: Thu Nov 15, 2007 10:35 am
by Badyl
Thanx :) work's fine

This template might be enclose to standard templates of CMS MS

Thanx RonnyK, you helped me not first time :)