MeekelTM Posted August 11, 2015 Share 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. Link to comment Share on other sites More sharing options...
Rikki Posted August 11, 2015 Share 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}} ... Link to comment Share on other sites More sharing options...
MeekelTM Posted August 11, 2015 Author Share Posted August 11, 2015 Thanks, much appreciated. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.