Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
MeekelTM Posted August 11, 2015 Posted August 11, 2015 Is it possible to find and use the position of a record in an array to then use the data stored?At the minute I could do:{{foreach $records as $record}} However that is of course all records. What I want to do is use the first record in the array in some way, then use the other records in another way.
Rikki Posted August 11, 2015 Posted August 11, 2015 In most places, zero-indexed arrays are used, so you can do something like:{{foreach $records as $idx => $record}} {{if $idx == 0}} First... {{endif}} ...In places where the key is something else, you can track it manually. Something like:{{$doneFirst = false;}} {{foreach $records as $record}} {{if !$doneFirst}} First... {{$doneFirst = true;}} {{endif}} ...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.