Search code examples
typo3typoscriptrecords

Typo3 extbase - HMENU with multiple records


I have a products extension with a "Details" view. "Product" records are kept in a folder with ID 5. When I am on a product I want to have a menu with links to all the products from that folder. I this possible in Typoscript?

Thank you.


Solution

  • You can do everything using TypoScript :-).

    lib.productList = CONTENT
    lib.productList {
      table = tx_myext_domain_model_product
      select {
        # sorting criterion
        orderBy = tstamp DESC
        # PID list
        pidInList = 46,47
        # Maybe restrict the number of results
        max = 20
      }
      # Each result must be rendered like this
      renderObj = COA
      renderObj {
        1 = TEXT
        # Each field from your table can be used
        1.field = title
        1.wrap = <h1>|</h1>
    
        2 = TEXT
        2.field = description
        # If one field contains rich text, you can apply RTE parsing to it
        2.parseFunc < lib.parseFunc_RTE
      }
    
    }
    

    Now you can use the cObject ViewHelper to display your list in the Fluid template:

    <f:cObject typoscriptObjectPath="lib.productList"></f:cObject>