XF 2.2 Get an array in template

mcatze

Well-known member
Hi guys,

i have some data to display in the template, but i couldn't get the data from the array. Can someone give me a hint?

If i set a dump() i got these vars. But i didn't get the data in foreach.

HTML:
{{ dump(vars()) }}
<div class="block">
    <div class="block-container">
        <div class="block-body">
                {$movie.title} <br>
                {$movie.overview} <br>
                {$movie.releaseDate} <br>
                {$movie.revenue} <br>
                {$movie.budget} <br>
                {$movie.runtime} <br>
                {$movie.homepage} <br>
            <xf:foreach loop="$movie.videos" value="$videos">
                {{ dump($videos) }}
                <xf:foreach loop="$videos" value="$video">
                    {$video.name}
                    {$video.key}
                </xf:foreach>
            </xf:foreach>
        </div>
    </div>
</div>
 

Attachments

  • Bildschirmfoto 2022-10-19 um 20.08.25.webp
    Bildschirmfoto 2022-10-19 um 20.08.25.webp
    44.5 KB · Views: 20
  • Bildschirmfoto 2022-10-19 um 20.10.12.webp
    Bildschirmfoto 2022-10-19 um 20.10.12.webp
    37 KB · Views: 20
The syntax is this:

HTML:
<xf:foreach loop="$var" value="$thing">
    {$thing}
</xf:foreach>

You already have the content with the first foreach.
Then you just extract it in the normal way.

On mobile due to Spectrum blocking my docsis 3.0 router so it's a bit difficult to type/post.
 
Top Bottom