Boost Posted September 15, 2023 Posted September 15, 2023 Hi, I have a fiedlsetpage called Hero. Inside this fieldset, I have a repeater called Buttons. The repeater has only one field type inside called button, that is a FieldtypeButton. Now, I'm trying to output this setup with: <div class="caption-cta-wrapper uk-margin-medium-top"> <?php foreach($page->hero->buttons as $btn) {echo $btn;} ?> </div> But the only output I get are some ids...like 1545 1021. What am I doing wrong? Thanks!
LMD Posted September 15, 2023 Posted September 15, 2023 You forgot to call the fieldname 'button' - you are echoing the repeater items (which uses the ID as toString output). Try this: <div class="caption-cta-wrapper uk-margin-medium-top"> <?php // 'buttons' is a repeater field, so '$btn' is a repeater item foreach($page->hero->buttons as $btn) { echo $btn->button; // <-- fieldname! } ?> </div> 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now