Hi all,
Newbie here, so hopefully I'm not asking too silly a question.
Following a tutorial, I've set up a very simple site. I've created a page with three (test) childpages. The template file of the parent page is supposed to display all the child pages' fields using a foreach loop. The code I've inserted in the template file is:
<div>
<?php
foreach($page->children as $element); ?>
<h3><?=$element->sp_title; ?></h3>
<?=$element->sp_content; ?>
<? endforeach; ?>
</div>
It all seems to be working, but only the last child page's fields are returned in the output, and not all three pages as I was expecting (when I change the order of the child pages, the contents of the outputted field changes to the one that is the last child page now).
What am I doing wrong? The PHP is working, but the child pages do not seem to be traversed. Any help is welcome. Thanks in advance.
/Silvio