Zum Inhalt springen

Zwei Templates je nach Inhalten

Erstellt am 15. Mai 2008 · 3 Antworten · letzte Antwort am 12. Juni 2008

Tags: Templates & Layouts, Frage

kike ·

Ich habe zwar schon einige Erfahrung mit Typo3, aber mit Typoscript tue ich mich nach wie vor schwer. Jetzt möchte ich folgendes realisieren:

Im Backend habe ich noch die Spalte Normal und Rechts. Wenn lediglich in der Spalte Normal ein Text ist, soll das Template Nr. 1 verwendet werden, wenn es Text in der rechten Spalte gibt das Template Nr. 2.

Wie lässt sich das am einfachsten realisieren?

Im Typo3-Kochbuch gibt es auf Seite 343 eine verwandte Lösung, aber, offen gestanden, verstehe ich sie nicht vollständig und so weit ich sie verstehe, scheint die für meinen Wunsch zu kompliziert.

einpraegsam.​net ·

Das hatten wir sehr oft schon hier im Forum:

Template Änderung:

temp.maintemplate= COA
temp.maintemplate {
  10 = COA
  10 {
    if.isTrue.numRows < styles.content.getRight
    10 = TEMPLATE
    10 {
       
      template = FILE
      template.file = fileadmin/templates/template-2column.html
    }
  }
  20 = COA
  20 {
    if.isFalse.numRows < styles.content.getRight
    10 = TEMPLATE
    10 {
       
      template = FILE
      template.file = fileadmin/templates/template.html
    }
  }
}

CSS Änderung:

page.headerData = COA
page.headerData {
        10 = COA
        10 {
                if.isTrue.numRows < styles.content.getRight
                10 = TEXT
                10.value = <link rel="stylesheet" type="text/css" href="fileadmin/3spalten.css" />
        }
        20 = COA
        20 {
                if.isFalse.numRows < styles.content.getRight
                10 = TEXT
                10.value = <link rel="stylesheet" type="text/css" href="fileadmin/2spalten.css" />
        }
       
}
kike ·

Danke für die schnelle Antwort, ich werde das probieren.

Das hatten wir sehr oft schon hier im Forum:

Ich hatte zwar gesucht, aber dann wohl mit falschen Stichworten. Tut mir leid.

minimalize ·

Hab mal das Thema hier aufgegriffen weil ich ein Problem habe. Irgendwie läuft die if.isTrue nicht richtig. Es wird nur die 2te (also die if.isFalse) verwendet. Der Inhaltsmarker der das ganze aktivieren soll heisst module1.

Aber hier mal ein Auszug noch aus meiner extTables.php damit keine Unklarheiten aufkommen:

t3lib_extMgm::addPageTSConfig('mod.SHARED.colPos_list = 0,1,2,3,4,5,6,7,8,9');



$TCA["tt_content"]["columns"]["colPos"]["config"]["items"] = array (

"0" => array ("2colleft||2ColLeft||||||||","0"),
"1" => array ("2colright||2ColRight||||||||","1"),

"4" => array ("module1||Modul1||||||||","4"),
"5" => array ("module2||Modul2||||||||","5"),
"6" => array ("module3||Modul3||||||||","6"),


);

Und hier mal mein TScript:

seite = PAGE
seite {
     typeNum = 0
     bodyTag = <body onload="">
     includeCSS.file1000 = fileadmin/templates/2-3col/css/main.css
     meta.AUTHOR = D4Media.eu
     meta.DESCRIPTION = Cordless Radio
     config.doctype = xhtml_strict     
     10 = COA
     10 {
          if.isTrue.numRows < styles.content.module1
          10 = TEMPLATE
          10 {
               template = FILE
               template.file = fileadmin/templates/2-3col/index.html
               <INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/tscript/template_marker.ts" >
          }
          
     }
     20 = COA
     20 {
          if.isFalse.numRows < styles.content.module1
          10 = TEMPLATE
          10 {
               template = FILE
               template.file = fileadmin/templates/2-3col/index2.html
               <INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/tscript/template_marker.ts" >
          }
          
     }  

}