interrobang Posted June 12, 2012 Share Posted June 12, 2012 I am trying to output all content of all my pages on a single page to get a quick overview where some content is still missing. It doesn't have to be pretty, and the resulting output of the MarkupPageFields.module is sufficient for my purpuse, but I am missing the content of my repeater field. Is there anything simple I can do to include my repeaters fields? This is basically my code: function listPageFields($page) { echo "<h1>{$page->title}:</h1>"; echo $page->renderFields(); if($page->numChildren) { foreach($page->children as $child) listPageFields($child); } } listPageFields($pages->get('/')); Link to comment Share on other sites More sharing options...
apeisa Posted June 12, 2012 Share Posted June 12, 2012 Not sure if this works, but let's assume your repeater field is called "repeater": function listPageFields($page) { echo "<h1>{$page->title}:</h1>"; echo $page->renderFields(); foreach($page->repeater as $p) { echo $p->renderFields(); } if($page->numChildren) { foreach($page->children as $child) listPageFields($child); } } listPageFields($pages->get('/')); 1 Link to comment Share on other sites More sharing options...
interrobang Posted June 13, 2012 Author Share Posted June 13, 2012 Thank you apeisa, It worked. I just changed your code to this, so that empty/waiting repeaters are not echoed: foreach ($page->repeater as $p) { if ($p->status == Page::statusOn) echo $p->renderFields(); } Link to comment Share on other sites More sharing options...
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