Jump to content

limit selector


amirp
 Share

Recommended Posts

Hi,

i'm new to processwire and programming in general.

i'm trying to select limited no. of images in a page. i guess i would have to use 'limit' in selector but can't get it right.

say i have to get 6 of many image in a page. how do i limit in below code?

plz help!

<?php

$gallery=$page->child("template=gallery_page");

if(!$gallery instanceof NullPage) {

$images = $page->images;

foreach($images as $image){

$thumb = $image->size(194, 111);

echo "<div class='photo'> <a href='{$page->url}gallery' title='$image->description'><img src='$thumb->url' alt='$image->description' width='$thumb->width' height='$thumb->height' /></a> </div>";

}

}

?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...