How can I get a field value if the fieldname has whitespaces?
Or should I prevent whitespaces in fieldnames?
First “print” works.
Second “print” does not work.
$footerAddress = $site->find('contact')->addresses()->toStructure()->findBy('function', 'Architektur und Gestaltung');
print($footerAddress->field('street and number'));
What do you mean by field name? A Kirby field name may not have whitespaces. PHP does not allow dashes or whitespaces in function names.
I mean for example this:
I can call the firm like this:
But how can I call “street and number”?
I thought that kirby maybe would autoremove the whitespace to call the field-value.
The only allowed characters in field names are alphanumeric characters and underscores:
As already mentioned above, in PHP no other characters are allowed for functions (and field names are used as functions).
Did you add that content manually in the text files? Because your yaml linter should actually have complained if you tried to define such fields in a blueprint
No, I did add the content of the structured field via the panel, not manually in the text file.