Jump to content

Silster

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Silster

  1. Yes, I had missed the ?php before the endforeach. Thanks a lot for your help! Really appreciate it! Best regards, Silvio
  2. Hi LostKobraKai, Thanks for the quick reply. I'm not very fluent in PHP, so I missed that one. However, when I change the semicolon to a colon as you suggest, it throws up an error: Parse Error: syntax error, unexpected end of file (line 32...) (Line 32 refers to the closing </html> tag in the template file.)
  3. 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
×
×
  • Create New...