[solved] News display a list articles'title

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
henris17
Forum Members
Forum Members
Posts: 70
Joined: Sun Feb 06, 2011 11:11 pm

[solved] News display a list articles'title

Post by henris17 »

Hello,

I would like to do the following:

on a same page :

1. Display the complete summary of the 6 last articles.
followed by
2. only the titles (and links) of the 20 following ones.

In other words:
Page1: Complete summary for article 1-6, fillowed by title of article 7-27

Page2: Complete summary for article 7 to 12 , followed by title of article 8-28
and so on.

Cheers

Henri
Last edited by henris17 on Tue Oct 16, 2012 2:14 pm, edited 1 time in total.
uniqu3

Re: News display a list articles'title

Post by uniqu3 »

In your Summary template where you do a foreach:

Pre CMSMS 1.11.x with Smarty2
Smarty2 docs: http://www.smarty.net/docsv2/en/languag ... oreach.tpl

Code: Select all

{foreach from=$items item='entry' name='pos'}
  <!-- show title, for example in unordered list or something -->
    <a href='{$entry->moreurl}' title='{$entry->title|cms_escape:htmlall}'>{$entry->title|cms_escape}</a> 
  {if $smarty.foreach.pos.index < 6}
  <!-- then here follows the rest of the template for first 6 articles -->
  {/if}
{/foreach}
CMSMS 1.11.x with Smarty3
Smarty3 docs: http://www.smarty.net/docs/en/language. ... oreach.tpl

Code: Select all

{foreach from=$items item='entry'}
  <!-- show title, for example in unordered list or something -->
    <a href='{$entry->moreurl}' title='{$entry->title|cms_escape:htmlall}'>{$entry->title|cms_escape}</a> 
  {if $entry@index < 6}
  <!-- then here follows the rest of the template for first 6 articles -->
  {/if}
{/foreach}
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: News display a list articles'title

Post by velden »

I suppose you could use some conditional formatting within the uses summary template of the news module.

Name the foreach loop and use the index property to obtain the current
http://www.smarty.net/docsv2/en/languag ... erty.index

Then you could use modulo and check for something like

if index%26 >= 0 and index%26 < 6 then show summary
else show only title

Examples (with section in stead of foreach)
http://www.smarty.net/forums/viewtopic.php?p=67864
henris17
Forum Members
Forum Members
Posts: 70
Joined: Sun Feb 06, 2011 11:11 pm

Re: News display a list articles'title

Post by henris17 »

Thanks, I will try this
henris17
Forum Members
Forum Members
Posts: 70
Joined: Sun Feb 06, 2011 11:11 pm

Re: News display a list articles'title

Post by henris17 »

Instead of Conditional formatting; I think I might use some class and format it in CSS
Post Reply

Return to “Modules/Add-Ons”