Jump to content
Reclus

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

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>';
}
?>

 

Share this post


Link to post
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

Share this post


Link to post
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>';
} 
    }
?>

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...