0
votes

I have a HTML Template which looks like the following:

 <div class="container container-settings">

     ###INHALT###

</div>

Now I want to add this template to more pages in TYPO3 and then insert content depending on the page via only one TypoScript file.

For example I want to to be shown the content on my page "page1" and "page2" as follows:

 marks {
    ===> if content from page1
    INHALT < styles.content.get
    INHALT.select.where = colPos=3
    INHALT.renderObj.stdWrap.wrap=<div class="styled-box">|</div> 

    ===> if content from page2
    INHALT < styles.content.get
    INHALT.select.where = colPos=5
    INHALT.renderObj.stdWrap.wrap=<div class="different-style">|</div> 
}

Is there a way to achieve this?

Thanks allready!

UPDATE

@nbar I updated the config as follows:

10 = TEMPLATE
10 {
template = FILE
template.file = fileadmin/layout_subsites.html
workOnSubpart = DOKUMENT  

marks {
 [globalVar = TSFE:id=3]
   INHALT < styles.content.get
   INHALT.select.where = colPos=2
 [global]

[globalVar = TSFE:id=4]
   INHALT < styles.content.get
   INHALT.select.where = colPos=0  
[global]

[globalVar = TSFE:id=5]
   INHALT < styles.content.get
   INHALT.select.where = colPos=0
   INHALT.renderObj.stdWrap.wrap=<div class="different-style">|</div>
[global]
}   
}

However, this doesn't work as i want it to. Am I making a big mistake, i guess?

1
` ===> if content from page1 ` can be done with [globalVar = TSFE:id=1] and to end the conndition just use [global]. The TSFE:id is the uid of the page (you see the id when you hover over the page in the backend, or when you not have realURL installed) - nbar
Could you maybe give me an example for that please? - Joggal
Is the rest ([globalVar = TSFE:id=1] ..) correct? I can give you the example but I just know about the IF-Statement, not the rest. - nbar
page1 has colPos=4 filled with content and page2 can have colPos=4 filled too. I want the TypoScript to select the right content of the page. So i can wrap these content differently. - Joggal

1 Answers

0
votes

Here is an example how "IF"-Statements works in Typoscript. The typoscript gets executed when the ID of the page fits.

I just copied the code inside the "IF"-Statement from your originalpost, so my example is just for the Conndition, not for the other code.

[globalVar = TSFE:id=1]
    marks.INHALT < styles.content.get
    marks.INHALT.select.where = colPos=3
    marks.INHALT.renderObj.stdWrap.wrap=<div class="styled-box">|</div> 
[global]

[globalVar = TSFE:id=2]
    marks.INHALT < styles.content.get
    marks.INHALT.select.where = colPos=5
    marks.INHALT.renderObj.stdWrap.wrap=<div class="different-style">|</div> 
[global]