typo3fluidtypo3-7.xtypo3-7.6.x

Look up a record with Fluid DatabaseQueryProcessor – without PID


In TYPO3 7.6, I would like to look up records from another (=any) page in a Fluidtemplate.

Based on https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Fluidtemplate/Index.html, I tried DatabaseQueryProcessor:

  renderObj = FLUIDTEMPLATE
  renderObj {
    file = {$fluidPartialsPath}/Debug.html
    dataProcessing {
      20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
      20{
        # regular if syntax
        if.isTrue.field = records

        table = tt_content
        # quick&dirty to see the SQL table
        # where = stubrdebug

        # will pass these in programmatically later
        colPos = 1
        uidInList = 5
        # this doesn't work
        pidInList = *

        as = myrecords

        dataProcessing {
          10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
          10 {
            references.fieldName = image
          }
        }
      }

    }
  }

The issue is that select always asks for a pid or add the one of the current page. So it behaves like a CONTENT Object.

How can I leave out the PID in the query?

All answers I could google point to simply using RECORDS – but I don't see how I could do that in dataProcessing. Is there a way?

PS on a larger scale: I would like to use fluid_styled_content's "Insert Records" Content Element to insert OTHER (=not from fsc), custom record types into the current page. I'm trying to build an own way to do that. Please tell me if that doesn't make sense and / or if there's an easier way than building everything from scratch.


Solution

  • As far as I can tell, dataProcessing only works on the current $data variable which needs to be filled in before, e.g. by a CONTENT object.

    The CONTENT object uses the select function to get is data, therefore you have to use its pidInList property to configure the range of pages taken into account. Records without a page should live in the root (pid=0) and can be selected by the root keyword.

    If you want to create a Insert Records functionality, then you should already have a list of uidfrom your records. Then you can simply use the RECORDS object to render the specific record, no matter on what page it is on.