Hope i´m the right forum..
I want every other news item to have a different style. Is it possible to modify the news module so that every other news item gets a different class?
Like this: http://www.emerfoto.nu/new/
Different css class on every other news item?
Re: Different css class on every other news item?
havent actually looked at news template as Im heading to bed but if it uses smarty foreach loop you can use smarty cycle
pseudo:
and then use div.row1 {...} and div.row2 {...}
hope this helps
pseudo:
Code: Select all
{foreach ...}
class="row{cycle values="1,2"}
{/foreach}
hope this helps
Re: Different css class on every other news item?
bloody excellent!
that did it - thanks
that did it - thanks
Re: Different css class on every other news item?
Hi all - I would like to do the same thing, and was able to partially recreate the effect based on this thread, but I do not understand enough to complete the task.
Pardon my ignorance - programming is not my strong suit.
I am using CMSMS v.13 Canary with News Module 2.013
In my summary template I wanted to alternate classes as well so I tried;
Which output the following;
Fatal error: Smarty error: [in module_db_tpl:News;displaysummary line 4]: syntax error: invalid attribute name: '...' (Smarty_Compiler.class.php, line 1533) in /path/to/public_html/lib/smarty/Smarty.class.php on line 1095
so I tried random bits of syntax like the following;
which outputs;
No error = Step in the right direction. However I truly do NOT know what the proper syntax that should complete the {foreach ...} loop is - If someone could provide further insight on this topic I would very much appreciate it.
Thank you for your time.
Pardon my ignorance - programming is not my strong suit.
I am using CMSMS v.13 Canary with News Module 2.013
In my summary template I wanted to alternate classes as well so I tried;
Which output the following;
Fatal error: Smarty error: [in module_db_tpl:News;displaysummary line 4]: syntax error: invalid attribute name: '...' (Smarty_Compiler.class.php, line 1533) in /path/to/public_html/lib/smarty/Smarty.class.php on line 1095
so I tried random bits of syntax like the following;
which outputs;
No error = Step in the right direction. However I truly do NOT know what the proper syntax that should complete the {foreach ...} loop is - If someone could provide further insight on this topic I would very much appreciate it.
Thank you for your time.
Re: Different css class on every other news item?
As I didnt really look at the template code last time I just quessed it uses foreach loop 
this is from svn version, but I quess it hasnt changed lately
change
to
at the beginning of the template
hope this helps

this is from svn version, but I quess it hasnt changed lately

change
Code: Select all
{foreach from=$items item=entry}
<div class="NewsSummary">
{if $entry->formatpostdate}
Code: Select all
{foreach from=$items item=entry}
<div class="NewsSummary{cycle values="1,2"}">
{if $entry->formatpostdate}
hope this helps
Re: Different css class on every other news item?
tsw: Thank you that was the solution.
Where I thought I needed;
I only needed;
Hopefully this'll help others. Thanks again!
Where I thought I needed;
Code: Select all
{foreach from=$items item=entry}
<div {foreach ...}class="news{cycle values="1,2"}{/foreach}">
...
{/foreach}
Code: Select all
{foreach from=$items item=entry}
<div class="news{cycle values="1,2"}">
...
{/foreach}
Hopefully this'll help others. Thanks again!