Reputation: 486
I have entities (let's say Posts
).
Inside each post I want to make possible pagination ("Next" and "Previous" buttons).
I can link to previous post and to the next. The problem is: I can make disabled button "Previous" if there's no posts to the left (if you're in first post, then it should be impossible to get to the 0
post), and what about getting post count?
{{ entity | length }}
is displaying current post id
.
What I want to achieve is that: when user is on latest post (let's say there are 300 posts), and on the 300-th post there should be disabled "Next" button (because there's no posts below this post)
P.S. I'm using symfony 2.7 and Twig as a templating engine
Upvotes: 0
Views: 282
Reputation: 184
I dont quite get the question but based on
What I want to achieve is that: when user is on latest post (let's say there are 300 posts), and on the 300-th post there should be disabled "Next" button (because there's no posts below this post)
If all you want is a paginator, why dont you use this bundle (KNP) ?
Bundles are the essence of Symfony2
Upvotes: 1