amirp Posted October 10, 2012 Share Posted October 10, 2012 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 More sharing options...
diogo Posted October 10, 2012 Share Posted October 10, 2012 Hi, and welcome to the forums! You're right, the limit selector can be used like this: $images = $page->images->find("limit=6"); 1 Link to comment Share on other sites More sharing options...
amirp Posted October 10, 2012 Author Share Posted October 10, 2012 thnx i'll try it right away it worked. thanks again. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now