Search code examples
typo3typo3-9.x

Add limit to Content Element


I setup a website with TYPO3 9x and I inserted a Content Element with this type :

Categorized content [menu_categorized_content]

The objective is to show the contents that are in a given category.

But I need to limit the number of content records to show only 3 records.

How can I add this function to limit to number of content ?


Solution

  • TYPO3 is using the DatabaseQueryProcessor to fetch the records from DB.

    Your can find the settings in:

    typo3/sysext/fluid_styled_content/Configuration/TypoScript/ContentElement/MenuCategorizedContent.typoscript
    

    The DatabaseQueryProcessor uses the default .select syntax from TypoScript, you can find the Docs here: https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Functions/Select.html#comprehensive-example

    You can just add this to your TypoScript:

    tt_content.menu_categorized_content.dataProcessing.10.max = 3