Jump to content

Its posible to Skip Posts


drilonb
 Share

Recommended Posts

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

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

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...