Jump to content

Recommended Posts

Posted (edited)

How do I get the output of a field that is a FieldTypePage?

I've tried

echo $page->first_name . " ";

but it just prints numbers instead of picking data from that page it's referencing to. Couldn't find any info on how to use this module/field either.

Edited by cstevensjr
Added Code Block
Posted

You need to reference the field from the selected page(s).

If the page field is set to store multiple pages you usually want to foreach through them:

foreach($page->page_field as $pf) {
    echo $pf->title;
}

That will return the titles of all the pages selected.

  • Like 2

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
×
×
  • Create New...