Skip to main content
replaced http://craftcms.stackexchange.com/ with https://craftcms.stackexchange.com/
Source Link

This won't work with your example, because the pagination-tag only accepts an ElementCriteriaModel, not an array of already fetched entries:

{% paginate MyCriteria as PageSubset %}

See also: What are the differences between an elementCriteriaModel and fetched elements?What are the differences between an elementCriteriaModel and fetched elements?


If I understand your code correctly, you want to get all entries which have an empty series-field?

If so, you don't have to fetch all entries and check against it, you can just add this to the ElementCriteriaModel:

{% set MyCriteria = craft.entries.section('databytes').series(':empty:') %}

{% paginate MyCriteria as entries %}
....
{% endpaginate %}

Why does the pagination tag need a CriteriaModel?

An ElementCriteriaModel can be compared to a sql query, it specifies what elements/entries to fetch (it sets the criteria). If you treat your CriteriaModel as an array or append .first() it will fetch those entries and replace the results with the CriteriaModel.

The pagination-tag needs a CriteriaModel (or "query") because it adds an offset (to the "query") depending on what page you are on, and then fetches the entries. - That's why the pagination-tag doesn't work with already fetched entries.

This won't work with your example, because the pagination-tag only accepts an ElementCriteriaModel, not an array of already fetched entries:

{% paginate MyCriteria as PageSubset %}

See also: What are the differences between an elementCriteriaModel and fetched elements?


If I understand your code correctly, you want to get all entries which have an empty series-field?

If so, you don't have to fetch all entries and check against it, you can just add this to the ElementCriteriaModel:

{% set MyCriteria = craft.entries.section('databytes').series(':empty:') %}

{% paginate MyCriteria as entries %}
....
{% endpaginate %}

Why does the pagination tag need a CriteriaModel?

An ElementCriteriaModel can be compared to a sql query, it specifies what elements/entries to fetch (it sets the criteria). If you treat your CriteriaModel as an array or append .first() it will fetch those entries and replace the results with the CriteriaModel.

The pagination-tag needs a CriteriaModel (or "query") because it adds an offset (to the "query") depending on what page you are on, and then fetches the entries. - That's why the pagination-tag doesn't work with already fetched entries.

This won't work with your example, because the pagination-tag only accepts an ElementCriteriaModel, not an array of already fetched entries:

{% paginate MyCriteria as PageSubset %}

See also: What are the differences between an elementCriteriaModel and fetched elements?


If I understand your code correctly, you want to get all entries which have an empty series-field?

If so, you don't have to fetch all entries and check against it, you can just add this to the ElementCriteriaModel:

{% set MyCriteria = craft.entries.section('databytes').series(':empty:') %}

{% paginate MyCriteria as entries %}
....
{% endpaginate %}

Why does the pagination tag need a CriteriaModel?

An ElementCriteriaModel can be compared to a sql query, it specifies what elements/entries to fetch (it sets the criteria). If you treat your CriteriaModel as an array or append .first() it will fetch those entries and replace the results with the CriteriaModel.

The pagination-tag needs a CriteriaModel (or "query") because it adds an offset (to the "query") depending on what page you are on, and then fetches the entries. - That's why the pagination-tag doesn't work with already fetched entries.

added 724 characters in body
Source Link
Victor
  • 8.4k
  • 1
  • 36
  • 61

This won't work with your example, because the pagination-tag only accepts an ElementCriteriaModel, not an array of already fetched entries:

{% paginate MyCriteria as PageSubset %}

See also: What are the differences between an elementCriteriaModel and fetched elements?


If I understand your code correctly, you want to get all entries which have an empty series-field?

If so, you don't have to fetch all entries and check against it, you can just add this to the ElementCriteriaModel:

{% set MyCriteria = craft.entries.section('databytes').series(':empty:') %}

{% paginate MyCriteria as entries %}
....
{% endpaginate %}

Why does the pagination tag need a CriteriaModel?

An ElementCriteriaModel can be compared to a sql query, it specifies what elements/entries to fetch (it sets the criteria). If you treat your CriteriaModel as an array or append .first() it will fetch those entries and replace the results with the CriteriaModel.

The pagination-tag needs a CriteriaModel (or "query") because it adds an offset (to the "query") depending on what page you are on, and then fetches the entries. - That's why the pagination-tag doesn't work with already fetched entries.

This won't work with your example, because the pagination-tag only accepts an ElementCriteriaModel, not an array of already fetched entries:

{% paginate MyCriteria as PageSubset %}

See also: What are the differences between an elementCriteriaModel and fetched elements?


If I understand your code correctly, you want to get all entries which have an empty series-field?

If so, you don't have to fetch all entries and check against it, you can just add this to the ElementCriteriaModel:

{% set MyCriteria = craft.entries.section('databytes').series(':empty:') %}

{% paginate MyCriteria as entries %}
....
{% endpaginate %}

This won't work with your example, because the pagination-tag only accepts an ElementCriteriaModel, not an array of already fetched entries:

{% paginate MyCriteria as PageSubset %}

See also: What are the differences between an elementCriteriaModel and fetched elements?


If I understand your code correctly, you want to get all entries which have an empty series-field?

If so, you don't have to fetch all entries and check against it, you can just add this to the ElementCriteriaModel:

{% set MyCriteria = craft.entries.section('databytes').series(':empty:') %}

{% paginate MyCriteria as entries %}
....
{% endpaginate %}

Why does the pagination tag need a CriteriaModel?

An ElementCriteriaModel can be compared to a sql query, it specifies what elements/entries to fetch (it sets the criteria). If you treat your CriteriaModel as an array or append .first() it will fetch those entries and replace the results with the CriteriaModel.

The pagination-tag needs a CriteriaModel (or "query") because it adds an offset (to the "query") depending on what page you are on, and then fetches the entries. - That's why the pagination-tag doesn't work with already fetched entries.

Source Link
Victor
  • 8.4k
  • 1
  • 36
  • 61

This won't work with your example, because the pagination-tag only accepts an ElementCriteriaModel, not an array of already fetched entries:

{% paginate MyCriteria as PageSubset %}

See also: What are the differences between an elementCriteriaModel and fetched elements?


If I understand your code correctly, you want to get all entries which have an empty series-field?

If so, you don't have to fetch all entries and check against it, you can just add this to the ElementCriteriaModel:

{% set MyCriteria = craft.entries.section('databytes').series(':empty:') %}

{% paginate MyCriteria as entries %}
....
{% endpaginate %}