Hi folks
I have a parent page which contains a list of sub pages links. Each sub page link has a title and a picture. I'm also trying to make the background colour selectable from a range of options, using a page field.
All the sub pages contain a page field called $puff_color. This page field is set up as a select box and pulls values from pages with title only, such as yellow, blue, gray, black etc.
I'm trying to create a simple loop through all the child pages, whilst pulling these colours into the markup as a css class. I can't figure out why $puffColor doesn't show anything.
I'm not great with php so any help or advice would be appreciated.
Thanks
<?php
foreach($page->children as $article) {
$puffColor = $article->$puff_color->title;
echo "<section class='box-puff {$puffColor}'>
<div>...other content...</div>
</section>";
}
?>