I'm currently converting a static site (where this was obviously simple) and as a PHP beginner, I would ideally like to know whether the code will become so complicated that it's better to say to the client "Hey let's do this a different way".
I had a quick play around and I made a blog entries loop then an images loop, problem is I don't know if it's possible to loop them within another loop...
<?php // Show 3 blog entries
$entries = $page->children("sort=-sort, limit=3");
$count = 0;
foreach ($entries as $entry) {
$count++;
$class = "blog_box";
if ($entry == $entries->last()) {$class .= " blog_box_last"; }
if ($entry == $entries->first()) {$class .= " blog_box_first"; }
if (0 == $count % 2) { $class .= " blog_box_even"; }
?>
<div class="<?php echo $class; ?>">
<div class="blog_text">
<h3><?php echo $entry->title; ?></h3>
<h6><?php echo $entry->entry_date; ?></h6>
<p><?php echo $entry->body; ?></p>
</div><!-- /.blog_text -->
<?php if ($entry->image) {
$image = $entry->image->width(350);
?>
<img src="<?php echo $image->url; ?>" width="<?php echo $image->width; ?>" alt="<?php echo $entry->title; ?>" />
<?php } ?>
<div class="clear"></div><!-- /.clear -->
</div><!-- /.blog_box -->
<?php }
?>
// Show 3 blog images
<?php $blog_images = $page->get("image_uploads")->find("limit=3");
foreach ($blog_images as $img) {
$b_img = $img->size(200,140); ?>
<img src="<?php echo $b_img->url; ?>" width="<?php echo $b_img->width; ?>" height="<?php echo $b_img->height; ?>" alt="<?php echo $b_img->description; ?>" class="small_frame" />
<?php } ?>













