Jump to content

Start and Limit


Peter Knight
 Share

Recommended Posts

Hi

I'm unsure why my code below doesn't limit the results to 3 as specified.

I have a Repeater Matrix (pro fields) on my page with 10 items and I want to echo out slides 2,3,4 only 

IE Start from the second slide and limit to the next 3

		$items = $page->matrix_slider('start=1,limit=3');
		foreach($items as $slide) {
        echo "
				<div class='uk-width-1-1 uk-width-1-3@s'>
				<div class='desk-wrap uk-text-left'>
					
					<a href='{$slide->url}'><img src='{$slide->images->first()->size(640,320)->url}'></a>
					<div class='desk-wrap-content'>
					<h4><a href='{$slide->url}'>{$slide->title}</a></h4>
					{$slide->body_mini}<br/>
					<a href='{$slide->url}' class='uk-button uk-button-primary'>Read more</a>
					</div>
				</div>
				</div>

Thanks

 

 

Link to comment
Share on other sites

3 hours ago, dragan said:

Try to use slice()


$matrix = $pages->get(11203)->my_matrix;
$items = $matrix->slice(1, 3);

 

That's pretty cool. And new to me too. I'll try that tomorrow and file under 'new stuff'. In the meantime, Robin's observation had me back on track.

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