drilonb Posted May 23, 2011 Share Posted May 23, 2011 Hello i like to know is possible to skip post in category if i am using like this , <?php foreach($page->children("sort=-created, limit=1") as $child) { $image = $child->images->first(); $thumb = $image->size(80, 60); $summary = substr($child->body, 0, 95); $titulli = substr($child->title, 0, 31); echo " <a href='{$child->url}'><img src='{$thumb->url}' width='{$thumb->width}' height='{$thumb->height}' alt='Fros Group' /></a> <a href='{$child->url}'>$titulli</a> <p class='bardh'>Postuar me:{$child->datapost}</p> <p>$summary</p> "; } and i like to skip first 3 post and to show 4,5,6 etc... thanks. Link to comment Share on other sites More sharing options...
Adam Kiss Posted May 23, 2011 Share Posted May 23, 2011 There is also 'start' selector, you might want to use that. http://processwire.com/api/selectors/ $page->children("sort=-created, start=4, limit=3") This should return pages 4,5,6. I'm not sure about whether this is zero-based or what, so you might play with it a little to get a good grasp of it. Link to comment Share on other sites More sharing options...
drilonb Posted May 23, 2011 Author Share Posted May 23, 2011 Thanks ADAMKISS i try it now its work perfect i will play now with post in template, Link to comment Share on other sites More sharing options...
ryan Posted May 23, 2011 Share Posted May 23, 2011 Adam is correct (thanks Adam!). To follow up, it is zero based. And if you'd prefer to specify "start" and "end" rather than "start" and "limit", you could do this: $page->children("sort=-created, start=4, end=5"); However, I usually find it simpler to specify a limit. Also, since you are only asking for 1 item, there really isn't any need to use the foreach() and children(). Instead, you could just use this: $child = $page->child("sort=-created, start=4"); That will always return just 1 item, so there's also no need to specify a limit or an end. Link to comment Share on other sites More sharing options...
drilonb Posted May 23, 2011 Author Share Posted May 23, 2011 Thanks Ryan for your replay now i am using 2 of them start and end and everything is working now, Br, 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