Multiple includes in a foreach loop

3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 19, 2020   (RSS)

By Carl - October 19, 2020 - edited: October 19, 2020

Hi Toledoh,
With Option 1 you use a colon. The equivalent PHP to this is

<?php foreach ($panelsRecords as $record){ ?>

<?php include("_panelContent.php") ?>

<?php } ?>

For Option 2, you're using a semi-colon which terminates the loop right away. The equivalent to this is:


    <?php foreach ($panelsRecords as $record){ } include("_panelContent.php"); ?>
Carl

PHP Programmer

interactivetools.com

By Toledoh - October 19, 2020

Thanks Carl!

Cheers,
Tim (toledoh.com.au)