Jump to content

Call the results of a Select Options field in its parent page


Reclus
 Share

Recommended Posts

Hello. I'm trying to call the results of a child field into its parent page. The field is using the Select Options field with multiple check-boxes. I'm struggling to write workable code, I currently have this (see below) which doesn't work but may help explain what I am hoping to achieve ...  thanks in advance.
 

<?php

foreach($page->children as $item) {
  echo '<p>' . $item->tags . '</p>';
}
?>

 

Link to comment
Share on other sites

It looks like you never specify the name of the Options field.

You probably want:

foreach($page->children as $item) {
    foreach($item->optionsfield as $option) {
        echo '<p>'.$option.'</p>';
    }
}

 

  • Thanks 1
Link to comment
Share on other sites

Thanks very much Adrian, this has helped a great deal. I now have the code working , I ended up with this ...

<?php  
foreach($page->children as $item) {
foreach($item->tags as $item) {
echo '<li>' . $item->title . '</li>';
} 
    }
?>

 

Link to comment
Share on other sites

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...