typo3typoscripttypo3-7.x

How to put dynamic content from database in TYPO3 custom template?


I created my own custom template and backend layout. Here is my backend layout code :

backend_layout {
colCount = 3
rowCount = 2
rows {
    1 {
        columns {
            1 {
                name = Solution 1
                colPos = 1
            }
            2 {
                name = Solution 2
                colPos = 0
            }
            3 {
                name = Solution 3
                colPos = 2
            }
        }
    }
    2 {
        columns {
            1 {
                name = Products 1
                colPos = 3
            }
            2 {
                name = Products 2
                colPos = 4
            }
            3 {
                name = Products 3
                colPos = 5
            }
        }
    }
  }
}

Here is my custom template, I just have included the section of html file :

    <div class="row" id="solution">
      <!-- ###SOLUTIONLEFT### Start-->
      <!-- ###SOLUTIONLEFT### End-->
      <!-- ###SOLUTIONMID### Start-->
      <!-- ###SOLUTIONMID### End-->
      <!-- ###SOLUTIONRIGHT### Start-->
      <!-- ###SOLUTIONRIGHT### End-->
   </div>
   <div class ="row" id="product">
     <!-- ###PRODUCTLEFT### Start -->
     <!-- ###PRODUCTLEFT### End -->
     <!-- ###PRODUCTMID### Start -->
     <!-- ###PRODUCTMID### End -->
     <!-- ###PRODUCTRIGHT### Start -->
     <!-- ###PRODUCTRIGHT### End -->
   </div>

My page template code is :

 page.10.subparts {

     SOLUTIONLEFT< styles.content.getLeft

     SOLUTIONMID< styles.content.get

     SOLUTIONRIGHT< styles.content.getRight

     PRODUCTLEFT < styles.content.getLeft
     PRODUCTMID < styles.content.get
     PRODUCTRIGHT  < styles.content.getRight
  }

my backend screenshot I am trying to display product page info in second row. I am not able to do. So how to display it. Am I following proper way for creating template in typo3?

Can i do something like PRODUCTLEFT = style.content.getLeft.select = where row = 1 to display content from second row in backend?


Solution

  • You are nearly correct. You just need to specify the colPos from the Backend Layout of the content you want to assign to a subpart in your TypoScrip:

    page.10.subparts {
      ...
      PRODUCTLEFT < styles.content.get
      PRODUCTLEFT.select.where = colPos=3
      ...
    }
    

    styles.content.get styles.content.getLeft and styles.content.getRight are just preconfigured for the default colPos configuration TYPO3 shipps out of the box (0, 1 and 2).