Hi April,
Using your current code, this would be the simplest method:
<?php $counter = 1; ?>
<?php foreach ($blogsRecords as $blogs):
//This if statement will skip a loop if the daily post is found in the related header label.
if(in_array("The Daily Post", $blogs['header:labels']) || in_array("Parenting Tip of the Week", $blogs['header:labels']) ){ continue;}
//If three articles have been displayed, exit out of the loop.
if($counter > 3){ break; }
?>
<?php
$num = $blogs['header'];
list($header_images_smallRecords, $header_images_smallMetaData) = getRecords(array(
'tableName' => 'header_images_small',
'where' => "num ='$num'",
));
?>
<?php if($count>3){$count=1;} ?>
<?php $count=3;?>
<div class="tabs-innerlft">
<?php foreach ($header_images_smallRecords as $header_image): ?>
<?php foreach ($header_image['image'] as $upload): ?>
<?php if ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" title="<?php echo $upload['info1'] ?>" class="image" /><br/>
<?php endif ?>
<?php endforeach ?></div>
<?php endforeach ?>
<div class="tabs-innerrgt">
<h3><a href="<?php echo $blogs['_link'] ?>"><span class="articlehead"><?php echo $blogs['title'] ?></span></a></h3>
<p><?php echo preg_replace("/<img[^>]+\>/i", "", maxWords($blogs['content'], 37)); ?>...<a href="<?php echo $blogs['_link']; ?>">More</a> </p></div>
<!-- increase the counter value by 1 -->
<?php $counter++; ?>
<?php endforeach; ?>
So I've added a counter that's value increases by one every time an about article is successfully displayed. When three articles are successfully displayed the counter will be equal to 4, and the if statement at the top will break out of the loop and stop it displaying anything else in the array.
You will also need to edit this limit from your getRecords function for the about section:
list($aboutRecords, $aboutMetaData) = getRecords(array(
'tableName' => 'about',
'limit' => '5',
));
This will make the getRecords function retrieve the first 5 records, as it might not display 2 of them, leaving 3 that that it can always display.
Let me know if you have any questions
Thanks
Greg
Greg Thomas
PHP Programmer - interactivetools.com