Page 1 of 1

[solved] News display a list articles'title

Posted: Mon Sep 03, 2012 11:13 pm
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

Re: News display a list articles'title

Posted: Tue Sep 04, 2012 8:01 am
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}

Re: News display a list articles'title

Posted: Tue Sep 04, 2012 8:05 am
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

Re: News display a list articles'title

Posted: Wed Sep 05, 2012 11:15 pm
by henris17
Thanks, I will try this

Re: News display a list articles'title

Posted: Thu Sep 06, 2012 9:09 pm
by henris17
Instead of Conditional formatting; I think I might use some class and format it in CSS