Hi there,
I'm hoping someone can help me out with a bit of Smarty logic in the News module.
What I am trying to do is create a template that has two parts to it. The first has some HTML that displays the latest news article in an unordered list with class="active" on the first . This needs to appear once, and can't be repeated on the other li's.
The next two news items can be displayed using the standard foreach loop. As I don't know Smarty that well, I just need some guidance as to what syntax I would use to achieve this. (Displaying the first article outside the loop, but having the loop continue to display the next two articles in the correct sequence.) It's almost working OK, but the first article is displaying a heading from another news section, with a summary from another news article. It's also displayinh 4 headings instead of three.
The template I am using is as follows:
{if isset($entry->fields)}
{foreach from=$entry->fields item='field'}
{if $field->type == 'file'}
{$entry->titlelink}
file_location}/{$field->value}" alt="News Photo"/>
{else}
{$field->name}: {eval var=$field->value}
{/if}
{/foreach}
{/if}
{foreach from=$items item=entry}
{$entry->titlelink}
{if isset($entry->fields)}
{foreach from=$entry->fields item='field'}
{if $field->type == 'file'}
file_location}/{$field->value}" alt="News Photo"/>
{else}
{$field->name}: {eval var=$field->value}
{/if}
{/foreach}
{/if}
{/foreach}
More top news stories >>
{$entry->title}
{eval var=$entry->summary}
{$entry->morelink}
{foreach from=$items item=entry}
More top news stories >>
{$entry->title}
{eval var=$entry->summary}
{$entry->morelink}
{/foreach}
Hope that all makes sense!
Thanks,
Nick.
News Module Smarty Logic
Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Let us know here.
Jump to
- Official Boards
- ↳ README FIRST!!!
- ↳ Announcements
- ↳ General Discussion
- Support Boards
- ↳ CMSMS Core
- ↳ Modules/Add-Ons
- ↳ Help Wanted (commercial)
- ↳ Translations
- Community Boards
- ↳ Tips and Tricks
- ↳ CMS Show Off
- ↳ Layout and Design (CSS & HTML)
- ↳ Feature ideas
- ↳ Developers Discussion
- ↳ The Lounge
- International Discussions
- ↳ Czech/Slovak - Česky/Slovensky
- ↳ Danish - Dansk
- ↳ Dutch - Nederlands
- ↳ Aankondigingen
- ↳ Tips en Trucs
- ↳ Vertalingen & Documentatie
- ↳ Hulp gezocht (commercieel)
- ↳ Finnish - Suomi
- ↳ French - Français
- ↳ German - Deutsch
- ↳ BITTE ZUERST LESEN !!!
- ↳ Ankündigungen
- ↳ Installation und Einstellungen
- ↳ Module und Tags
- ↳ Smarty-Tipps und -Tricks
- ↳ Layout und Design
- ↳ Suchmaschinenoptimierung (SEO)
- ↳ HowTo's
- ↳ Übersetzungen
- ↳ Show Off
- ↳ Hilfe gesucht (kommerziell)
- ↳ Stammtisch
- ↳ Hungarian - Magyar
- ↳ Italian - Italiano
- ↳ Moduli/Plugins
- ↳ Lithuanian - Lietuviškai
- ↳ Darbo / bendradarbiavimo pasiūlymai ir paieška
- ↳ Persian / Farsi
- ↳ Polish - Polski
- ↳ Portuguese - Português
- ↳ Russian - русский
- ↳ Предложения и поиск РАБОТЫ
- ↳ Spanish - Español
- ↳ Swedish - Svenska
- Geekmoot Editions
- ↳ Geekmoot 2016
- ↳ Connections and Conversations
- ↳ Geekmoot 2015
- ↳ Geek Moot 2012
- ↳ Locked: Geek Moot 2010
- Old Forums
- ↳ [locked] CMSMS 2.0 Beta
- ↳ Module Developers
- ↳ Closed Issues
- ↳ [locked] Documentation0ld
- ↳ Suggestions, Modifications & Corrections
- ↳ [locked] CMSMS 1.11 Beta
- ↳ Closed Issues
- ↳ [locked] CMSMS 1.10 Beta
- ↳ Closed Issues
- ↳ [locked] CMSMS 2.2 Beta
- ↳ [locked] CMSMS MLE fork
- ↳ Modules/Addon patchs
- ↳ [locked] Quality Assurance
- ↳ [locked] Accessability and Usability
- ↳ [locked] Documentation
- ↳ Media and presentations about CMSMS
- ↳ [locked] Installation, Setup and Upgrade

