Jump to content

[SOLVED] Can't output a repeater item inside a fieldsetpage.


Boost
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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>

 

  • Like 1
Link to comment
Share on other sites

  • Boost changed the title to [SOLVED] Can't output a repeater item inside a fieldsetpage.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...