9
votes
Using pagination on a page with url with query string data
In most Craft projects I do I'll create a pagination include file so anything I need that requires pagination, I can just include that and I get the same pagination pattern anywhere within my site ...
6
votes
Accepted
Getting the last X number of pages in pagination
As I already wrote in my comment 3 days ago something like this should work
{% paginate craft.entries.section('mySection').limit(10) as pageInfo, pageEntries %}
{% for page, url in pageInfo....
5
votes
Accepted
Check paginated currentPage before setting the paginate tag
Ok, so after discovering the getPageNum request, I found the following solution:
{% set pageNumber = craft.request.getPageNum %}
{% set firstPageLimit = 5 %}
{% set defaultLimit = 8 %}
{% set limit =...
5
votes
{% paginate %} Tag issue, no prevUrl / nextUrl Data
You need to set a limit on your element query, so Craft knows how many entries you want per page:
{% paginate craft.entries.section('newsBlog').limit(1) as pageInfo, pageEntries %}
If you don't set ...
5
votes
Accepted
Pagination and Entry Model on Homepage
project.images is an array because you are eager-loading the images.
Since you’re only loading one project entry, you’re not actually gaining anything by eager-loading the images (or category), ...
4
votes
Any examples of numeric pagination?
Good starting point: https://craftcms.com/docs/templating/paginate
If you also want display '...' instead of the whole list of page numbers, you can do something like this:
{% if pageInfo.totalPages ...
4
votes
Accepted
Including Zii in Craft CMS
Craft 2.x ships with a subset of the Yii framework files with things like zii and Yii widgets stripped out.
If you wanted to utilize them, you'd have to create a Craft plugin and manually include the ...
4
votes
Pagination with randomly ordered entries
Why is this happening?
Why am I seeing duplicates?
When the database is told to sort by random, the entire list of entries is being sorted into a random order before your required page of items is ...
4
votes
Accepted
provide a 'back' or 'cancel' or 'close' button to return to whatever page that particular template was accessed from
You could use the Cookies plugin to store the last visited URL before the user hits one of the "step" templates, i.e. by putting something like the following in every template where the links to the "...
4
votes
Order entries by a category field alphabetically then paginate
In order to sort your entries by a related field you need to join the relations and the content table and sort your entries by the column you want. The it doesn't change the behavior of your paginate
...
3
votes
Accepted
Using pagination on a page with url with query string data
The huge advantage of craft over other CMS is the high flexibility and the ability to customize many things. Thus Craft won't provide non changeable <a> tags but links you can change like you ...
3
votes
provide a 'back' or 'cancel' or 'close' button to return to whatever page that particular template was accessed from
If you need to set a correct link on the cancel buttons than using browser history is the easiest way.
{% if entry is defined %}
// Going to STEP2
<button onclick="window.history.go(-1); ...
3
votes
Accepted
Check which pagination page to display code outside of pagination loop
UPDATED/EDIT ANSWER:
If you only want to show the entries on the first page you should make an if statement to check if you are on the first page for your Featured Items by requesting the page number....
3
votes
Accepted
Only fetch structure entries that are first level or sub level that don't have a parent
You can use the hasDescendants() method to filter out any parent entry with children. You have to use an ElementCriteriaModel with .getPrev() and .getNext().
{% set entries = craft.entries.section( '...
3
votes
Pagination base URL - any way to have pagination links go to URLs other than current one?
Since version 3.1.28, you can set base URL of pagination links, like this:
{% paginate query as pageInfo, pageEntries %}
{% do pageInfo.setBasePath('new_url') %}
3
votes
How to link to previous/next entries in a section?
For navigating siblings in a structure there's a shortcut:
{% if entry.prevSibling %}<a href="{{ entry.prevSibling.url }}">Previous</a>{% endif %}
{% if entry.nextSibling %}<a ...
3
votes
Cache and Pagination not working
Based on the code you posted on pastebin, it seems like the problem is that you have your pagination outside of the cache tags (assuming this was the case when you had caching implemented). And, I'm ...
3
votes
Accepted
Graphql total results / pageinfo when searching with pagination
Try entryCount. You can also add arguments to this, such as section: entryCount(section:"news"), for example.
3
votes
Accepted
How to increase control panel pagination item count?
This has been asked before quite recently, and I don't believe there's been a better solution posted since then. Check out the answer on that post to see the solution, which involves using a bit of ...
2
votes
Paginate a matrix
Found the answer - I had to paginate the children of "inhoud". Works like a charm now :-)
{% for inhoud in entry.getDescendants() %}
{% if inhoud.type == 'segment' %}
<...
2
votes
Accepted
Paginate children in a structure
There are many ways to paginate:
To show next / prev links
#1
getPrevSibling getNextSibling
{% if entry.getPrevSibling %}
<a href="{{entry.getPrevSibling.url}}">{{entry.getPrevSibling....
2
votes
Accepted
filtering entries by category
You don't actually need to look at the URL segments, because Craft automatically populates your template with a category variable whenever it matches the current URL to a category's URL. All you need ...
2
votes
Accepted
pagination showing all entries
When you use {% paginate %}, the second variable that's returned, pageEntries, is the paginated entries. When you do craft.entries.section('news').featured('not 1') later in the template, you're ...
2
votes
How do I get Pagination to Work?
A couple of years later, I ran into the same issue. In case there are others looking, it looks like this line:
{% for page, url in paginate.getPreviousUrls(5) %}
Should be:
{% for page, url in ...
2
votes
Add page number to Title and meta desc
You'll need to add more details about your current setup for a more specific answer.
In general, adding a number to the Meta Title and Meta Description is probably not a good approach to solve your ...
2
votes
Order a paginated entry by postDate
The code above is correct and working properly. There was a conflict with a masonry js file making the Craft ordering not work. Big thanks to @Anubarak for testing the code on their side.
2
votes
Accepted
Allowing the user to update a CraftCMS pagination limit with listing filter options
You could create a form/a link with the limit and add the parameter in your $_GET request or as a segment to your url. This is just an example how to use it.
How many Entries would you like to get?
&...
2
votes
Accepted
Cache not invalidating when using pagination with cache
One issue I'm seeing, is that you're currently using craft.request.path as your cache key – however, that property doesn't actually include the pagination segment (i.e. the pageTrigger; p2, p3 or the ...
2
votes
Manually passing page number to paginate tag
If you're looking to display a set of Elements that simulate a paginated query, you might actually be looking for the offset Query parameter.
Here's an example of fetching a “page” of results based ...
2
votes
Accepted
Manually passing page number to paginate tag
Recently i needed such thing again and this time i foud out how to do this:
{% set query = craft.entries %}
{% set paginator = create('craft\\db\\Paginator', [query, {
pageSize: 3,
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
pagination × 123entries × 23
templating × 12
craft3 × 9
categories × 7
search × 7
ajax × 7
elementcriteriamodel × 6
cache × 5
group × 5
relations × 4
url × 4
routes × 4
array × 4
merge × 4
previous-next × 4
datetime × 3
forloop × 3
query × 3
relatedto × 3
loop × 3
channels × 3
limit × 3
plugin-development × 2
matrix × 2