Page 1 of 1

Problem with Module News

Posted: Fri Jun 17, 2016 5:18 pm
by krisek
hello
CMS ver 1.9.1
News 2.11

On the home page is a place with that display the news . The trouble is , and I want to get one from the list display is always on the top.

I need to pull "$ items.index," how can I do?

how can I bring news_id using the smarty template

Code: Select all

{foreach from=$items item=entry ???????}

Re: Problem with Module News

Posted: Fri Jun 17, 2016 9:17 pm
by chandra
Not sure what you want ...

You got index with

Code: Select all

{foreach from=$items item=entry name='topnews'}
and

Code: Select all

{$smarty.foreach.topnews.index}


variable inside the loop

http://www.smarty.net/docsv2/en/languag ... oreach.tpl

News ID sould be available with

Code: Select all

{$entry->id}
inside the loop.

Re: Problem with Module News

Posted: Fri Jun 17, 2016 9:42 pm
by Jo Morg
Please use always the latest documentation for smarty. In this case:
http://www.smarty.net/docs/en/language. ... oreach.tpl

Re: Problem with Module News

Posted: Sat Jun 18, 2016 9:44 am
by chandra
My posted link is correct ;)
krisek wrote: CMS ver 1.9.1
means Smarty2.

There are some differences to Smarty3 which could confuse the questioner.

Re: Problem with Module News

Posted: Sat Jun 18, 2016 11:21 am
by Jo Morg
Yeah, I totally missed the CMSMS version.

@krisek: Please upgrade as soon as possible, at least to CMSMS 1.12.2, but recommended to 2.1.4. Mainly for security and stability reasons.

Re: Problem with Module News

Posted: Sat Jun 18, 2016 8:02 pm
by krisek
THX !!

{foreach from=$items item=entry }

{if $entry->id=="175"}
<div class="NewsSummary">
(...)
</div>
{/if}
{/foreach}

It works !! :)