I was searching for an option to get some specific content by it’s field name – but with a variable field name. As hard as it is for me to describe the problem, as hard it is to search for a solution. So maybe you get the idea when you read my code:
<?php $items = [ "facebook", "twitter", "website" ] ?> <?php foreach ($items as $item) : ?> <?php if ($page->content->has($item)) : ?> <a href="<?php echo $page->getContent($item) ?>">Some link</a> <?php endif; ?> <?php endforeach; ?>
$page->getContent() is just there to illustrate what i am searching for.
$page->getContent() does not exist. Does anyone have an idea how to solve this?