Including content in a template - Accessing Fields

Hi! Iā€™m a complete novice at PHP and wanted to know how exactly I can take something from my content and display it on my website.

Example:

content_release:

        label: Release Plan

        type: structure

        style: table

        fields:

          week:

            label: KW

            type: text

            required: true

          starttest:

            label: Start Testphase

            type: date

            default: today

            required: true

I want to access that data I put in week, but not starttest.

The php I used:

<?= $page->content_release()->week()->kirbytext() ?>

What I get is:

week: KW10/2021
starttest: 2021-02-15

Which is correct, except that I just want ā€œKW10/2021ā€

Thankful for any help!

Found a solution using a foreach, maybe it helps others:

        <?php
           foreach($page->content_release()->toStructure() as $data){
            
               echo "Week: ".$data->week();

           }
        ?>

Gives out

Week: KW10/2021

2 Likes