Bolt.tips

Outputting the total number of Records for a contentType

If you wish to output the total number of Records in a given Contenttype, you might want to do this:

{{ records|length() }} 

This will not give the correct result, though. It'll output the number of records on the current page, as configured. Because records is actually a Pagerfanta Object, the desired number can be fetched using nbResults, as documented in the Pagerfanta documentation.

{{ records.nbResults }}

Twig Templating

Permalink - Written by Bob on March 13, 2021.

« How to configure SEO-friendly URLs without ContentType - Finding all rows in the database related to a Record »