If count equals multiple of 5
Posted: 14 October 2008 05:50 AM   [ Ignore ]  
Research Assistant
RankRankRank
Total Posts:  375
Joined  07-06-2008

Im trying to check for multiples of 5. Currently this works.

{exp:weblog:entries weblog="ltn_articles|ltn_bvb" disable="catgories|member_data|trackbacks" sort="desc" dynamic="on" paginate="bottom"}

                            {if count
== 5 || count == 10}
                                Multiple of 5
                            {
/if}
{
/exp:weblog:entries}

But is there a better function to use for this? Otherwise I would have to do {if count == 5 || count == 10} || {if count == 15 || count == 20} and so forth

 Signature 

Live the News For a fun read on news entertainment and pop-culture

Profile
 
 
Posted: 14 October 2008 06:19 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

You can chain together multiple conditionals, like so:

{if count == 5 || count == 10 || count == 15 || count == 20}

and so on. If you want a different solution, you’ll need PHP:

<?php if (!{count} % 5) { ?>

   This is happens every 5th entry
:)

<?php } ?>

Give that a try.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 14 October 2008 06:31 AM   [ Ignore ]   [ # 2 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6543
Joined  04-15-2006

Also don’t forget the {switch=“option_one|option_two|option_three”} variable as well.

May help out depending on what exactly you need the test for?

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64912 Total Logged-in Users: 27
Total Topics: 81864 Total Anonymous Users: 17
Total Replies: 440102 Total Guests: 176
Total Posts: 521966    
Members ( View Memberlist )
Newest Members:  bjmohrAqua193Bios Elementmjpoteetguimogranwelshmrcfthenetmonkeybenekwhobutsb