Jump to content

new pages don't render foreach


wishbone
 Share

Recommended Posts

very strange behaviour:
- pages created before work and render foreach data.
- new pages with the same template show header and footer and nav ok, but don't render foreach-data any more.
- foreach-data in the head-navigation is rendered ok.
- child pages (without foreach) work ok

I checked and compared all settings.
Must be a very stupid simple setting.
I'm confused.

Any idea, where else I could look?

this is the code for the template:

<?php

include('_head.php'); // include header markup

  foreach ($page->children as $child) {	
	echo "<section>";
	echo "<div class='contentWrap uebersicht'>";
	echo "<a href='$child->url'><h1>{$child->arbeiten_block->first()->headline}</h1>";
	if($child->teaserBildTh) echo "<p><img src='{$child->teaserBildTh->url}' alt='{$child->teaserBildTh->description}' class='bildNeben'></p>"; 
	echo "<p>{$child->arbeiten_block->first()->details}</p></a>";
	echo "</div>";
	echo "</section>";
	};

	include('_foot.php'); // scripts
?>;

 

thx!
 

Link to comment
Share on other sites

One possibility is that the pages are hidden, unpublished or no-access, which are ignored by default by $page->children.

Try adding an 'include=all' selector to see if the material from the pages then appears:

foreach($page->children("include=all") as $child) {	

 

  • Thanks 1
Link to comment
Share on other sites

omg, that's it! unpublished children don't show. (which is sensible)

Big thx!

 

yes, thank you, shows!

But why?

Why do old pages show without?

Anyway, now not published pages show as well.

  • Like 1
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...