Loading...
 
Features / Usability

Features / Usability


How to compare prior values in a section loop

posts: 3665 United States

How can I read the previous value in a loop?

For example I have

Image
Copy to clipboard
{ section name="foo" loop="$somecounter"} . . . { /section}


But in the section loop, I want check the current value of an array item against the previous. I tried this:

Image
Copy to clipboard
{ section name="foo" loop="$someCounter"} . { if $variable[someCounter] = $variable[someCounter - 1] then do this { else} do this { /if} . . { /section}


But adding the -1 seems to break the php. Can anyone help?

Thanks,

-Rick

There are no comments at this time.

Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting