Categories > TinyButStrong general >

Displaying the first item of an array

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Michael Frey
Date: 2016-09-01
Time: 08:25

Displaying the first item of an array

I have the following array

$headers = array(
    'en' => 'English Bla Bla',
    'fr' => 'something else',
    'de' => 'more stuff'
);

I want to merge the headers field but ONLY display the first item in the array.

How would I do this no matter what the country code is, because in some cases there might be no 'en' header or the languages might be sorted differently.

Thanks



By: Skrol29
Date: 2016-09-02
Time: 08:51

Re: Displaying the first item of an array

Hi,

You can use the TBS behavior that merge only the first record for a block that has no "block" definition.

Example : the TBS field [h.val] will be merged with first record if you do :
$TBS->MergeBlock('h', $headers);