0

In a TYPO3 project, I have an array in my fluid template :

{subfamilies} [
    france = Paris
    germany = Berlin
    united_kingdom = London
    spain = Madrid
    usa = New York
]

It works perfectly but I need to access specific items via the key. I get the key inside a variable 'my_key' ( == 'france' ) Below is what I already tried :

{subfamilies.{my_key}}
{subfamilies."{my_key}"}
{subfamilies.'{my_key}'}
{subfamilies.{{my_key}}}

It doesn't work. I tried a lot of solutions.. with no effect.

Any idea ?

2
  • What TYPO3 version do you use? This is possible since TYPO3v8. Commented Apr 19, 2018 at 10:59
  • Hello @MathiasBrodala , i'm using Typo3 6.2 Commented Apr 19, 2018 at 11:27

1 Answer 1

0

Given that you use TYPO3 6.2 the only option you have is using the v:variable.get viewhelper of the VHS extension:

<v:variable.get name="subfamilies.{my_key}" />

In TYPO3v8 and newer the following works out of the box:

{subfamilies.{my_key}}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.