简体   繁体   中英

TYPO3 - multiple pages via TypoScript

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?

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM