interrobang Posted June 12, 2012 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('/'));
apeisa Posted June 12, 2012 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
interrobang Posted June 13, 2012 Author 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(); }
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