Last active
January 3, 2016 13:09
-
-
Save ianshea/8467363 to your computer and use it in GitHub Desktop.
Paginated JSON for Craft Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
{% paginate craft.entries.section('project').type(['work']).limit( paginationExtends.basicNumber ) as entries %} | |
{% if paginate.nextUrl %} | |
"nexturl" : "{{paginate.nextUrl}}", | |
{% endif %} | |
"projects" : | |
[ | |
{% for entry in entries %} | |
{% set workPoster = craft.assets.first({ childOf: entry, childField: 'workPoster' }) %} | |
{ | |
"title" : "{{entry.title}}", | |
"url" : "{{ entry.url }}", | |
"client" : "{{ entry.parent.title }}", | |
"thumb" : "{{ workPoster.getURL('listThumb') }}", | |
"worktype" : "{% for option in entry.workType %}{{ option }}{% if not loop.last%},{% endif %}{% endfor %}" | |
}{% if not loop.last %},{% endif %} | |
{% endfor %} | |
] | |
{% endpaginate %} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment