[TYPO3-german] Fluid Typo3 9.5.3 nur bei ColPos= 0 dem <p>-Tag eine Klasse zuweisen

Birgit lists at berlin-typo3.de
Sat Jan 12 19:36:18 CET 2019


Hallo Heike,

dir fehlen vielleicht an anderer Stelle 3 Klammern.

Bei mir funktioniert es in TYPO3 9.x - allerdings nur ohne die Condition.

Das heißt, die Manipulation lässt sich so nicht auf eine Spalte eingrenzen.

Voraussetzungen:

EXT: fluid_styled_content 
EXT: rte_ckeditor
sind geladen

Funktioniert in der Form nicht mit EXT:rtehtmlarea.

Das TypoScript muss NACH dem TypoScript von EXT: fluid_styled_content geladen werden, weil es deren Konfiguration überschreibt.


So funktioniert es mit Condition:
---------------------------------------------

Du brauchst eine eigene lib.parseFunc.

Die Condition muss im Fluid Template angelegt werden.
Dafür musst du die betreffenden Fluid-Templates für die Contentelemente aus EXT:fluid_styled_content überschreiben.



### TypoScript Setup

lib.parseFunc_ColPos_0 < lib.parseFunc_RTE
lib.parseFunc_ColPos_0 {
	externalBlocks := addToList(p)
	externalBlocks {
		p {
			stdWrap {
   				HTMLparser = 1
   				HTMLparser {
      				 	tags.p.fixAttrib.class {
           					default = lead
           					always = 1
           					list = lead
                      	}
      	 	        	}
       				keepNonMatchedTags = 1
          		 }	
       		}
   	}
}

# Fluid-Templates für die Contentelemente aus fluid_styled_content überschreiben
# Kopien der Templates, die geändert werden sollen, in einem Verzeichnis ablegen, fileadmin oder eigene Extension
styles.templates {
    layoutRootPath = EXT:br_ext_fluidstyledcontent/Resources/Private/Layouts
    templateRootPath = EXT:br_ext_fluidstyledcontent/Resources/Private/Templates
    partialRootPath = EXT:br_ext_fluidstyledcontent/Resources/Private/Partials

}


### Fluid Template
# z.B. EXT:br_ext_fluidstyledcontent/Resources/Private/Templates/Text.html
<f:if condition="{colPos}==0">
    <f:then><f:format.html parseFuncTSPath="lib.parseFunc_ColPos_0">{data.bodytext}</f:format.html></f:then>
    <f:else><f:format.html>{data.bodytext}</f:format.html></f:else>
</f:if>



Um dein Ziel anders zu erreichen kannst du alternativ z.B:

- die Manipulation per CSS bzw. SASS/LESS machen, wie ich schon beschrieben hatte

- oder per JavaScript den <p> Tags die Klasse zuweisen


viele Grüße
Birgit




> Am 12.01.2019 um 16:48 schrieb Heike Herzog-Kuhnke <hhk at kuhnke-owl.de>:
> 
> Also ich hatte es jetzt noch mal in meinem Typoskript für den MainContent drin und hier hat mir die Template Analyse freundlich mitgeteilt, dass ihr drei schließende Klammern fehlen, die ich eingefügt habe (leider ohne erfolg...)
> 
> --------------------
> 
> [globalVar = TSFE:tt_content|colPos = 0]
> # alternativ
> // [globalVar = TSFE:tt_content|colPos = 0, CType = text]
> 
> lib.parseFunc_RTE {
> 	externalBlocks := addToList(p)
> 	externalBlocks = p
> 	externalBlocks {
> 		p {
> 			stdWrap {
>    				HTMLparser = 1
>    				HTMLparser {
>       				 tags.p.fixAttrib.class {
>            			default = lead
>            			always = 1
>            			list = lead
>                       }
>       	 	        }
>        	keepNonMatchedTags = 1
>            }
>        }
>    }
> }
> [global]
> -------------------
> 
> Auch der Text mit der Alternative der globalVar Condition hat leider nichts gebracht...
> 
> LG
> Heike
> 
> Am 12.01.19 um 08:45 schrieb Heike Herzog-Kuhnke:
>> Nachtrag:
>> In den Ressourcen der Seite machts das auch nicht :(
>> LG
>> Heike
>> Am 12.01.19 um 08:42 schrieb Heike Herzog-Kuhnke:
>>> Hmhhh,
>>> 
>>> also ich hab das jetzt an drei Stellen ausprobiert.
>>> Im Objekt selbst:
>>> -------------------------
>>> lib.mainContent = COA
>>> 
>>> [globalVar = TSFE:tt_content|colPos = 0]
>>> # alternativ
>>> // [globalVar = TSFE:tt_content|colPos = 0, CType = text]
>>> 
>>> lib.parseFunc_RTE {
>>>      externalBlocks := addToList(p)
>>>      externalBlocks = p
>>>      externalBlocks {
>>>          p {
>>>              stdWrap {
>>>                      HTMLparser = 1
>>>                      HTMLparser {
>>>                          tags.p.fixAttrib.class {
>>>                          default = lead
>>>                          always = 1
>>>                          list = lead
>>>                  }
>>>              keepNonMatchedTags = 1
>>>      }
>>> }
>>> 
>>> [global]
>>> 
>>> lib.mainContent {
>>>              10 = COA
>>>              10 < styles.content.get
>>>              10.select.where = colPos=0
>>> 
>>> 
>>>        }
>>> }
>>> 
>>> ---------------------
>>> 
>>> ändert nix...
>>> 
>>> Im Typoskript der Seite:
>>> mal so:
>>> -----------------------
>>> config {
>>>    doctype = xhtml_trans
>>>    htmlTag_langKey = de
>>>    xmlprologue = none
>>>    language= de
>>>    locale_all = de_DE
>>>    contentObjectExceptionHandler = 0
>>>    }
>>> 
>>> 
>>> page = PAGE
>>> page.shortcutIcon = fileadmin/templates/images/favicon.ico
>>> page.meta.viewport  = width=device-width, initial-scale=1.0
>>> 
>>> 
>>> [globalVar = TSFE:tt_content|colPos = 0]
>>> # alternativ
>>> // [globalVar = TSFE:tt_content|colPos = 0, CType = text]
>>> 
>>> lib.parseFunc_RTE {
>>>      externalBlocks := addToList(p)
>>>      externalBlocks = p
>>>      externalBlocks {
>>>          p {
>>>              stdWrap {
>>>                      HTMLparser = 1
>>>                      HTMLparser {
>>>                          tags.p.fixAttrib.class {
>>>                          default = lead
>>>                          always = 1
>>>                          list = lead
>>>                  }
>>>              keepNonMatchedTags = 1
>>>      }
>>> }
>>> 
>>> [global]
>>> 
>>> page {
>>>      1 = FLUIDTEMPLATE
>>>      1 {
>>>          file = fileadmin/templates/BootstrapOWL/templates/template.html
>>>          partialRootPath = fileadmin/templates/BootstrapOWL/partials
>>>          layoutRootPath = fileadmin/templates/BootstrapOWL/layouts
>>> 
>>>      }
>>> 
>>>      includeCSS.bootCSS = fileadmin/templates/BootstrapOWL/css/bootstrap.css
>>>      includeCSS.carousel = fileadmin/templates/BootstrapOWL/css/caroussel.css
>>>      includeJSFooter.jquery = https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js
>>>      includeJSFooter.bootstrap = fileadmin/templates/BootstrapOWL/js/bootstrap.min.js
>>>      includeJSFooter.iewa = fileadmin/templates/BootstrapOWL/ja/ie10-viewport-bug-workaround.js
>>> 
>>>      variables {
>>>        hauptText < styles.content.get
>>>        hauptText.select.where = colPos=0
>>> 
>>>      }
>>> }
>>> --------------------------
>>> 
>>> und mal so:
>>> 
>>> --------------------------
>>> 
>>> config {
>>>    doctype = xhtml_trans
>>>    htmlTag_langKey = de
>>>    xmlprologue = none
>>>    language= de
>>>    locale_all = de_DE
>>>    contentObjectExceptionHandler = 0
>>>    }
>>> [globalVar = TSFE:tt_content|colPos = 0]
>>> # alternativ
>>> // [globalVar = TSFE:tt_content|colPos = 0, CType = text]
>>> 
>>> lib.parseFunc_RTE {
>>>      externalBlocks := addToList(p)
>>>      externalBlocks = p
>>>      externalBlocks {
>>>          p {
>>>              stdWrap {
>>>                      HTMLparser = 1
>>>                      HTMLparser {
>>>                          tags.p.fixAttrib.class {
>>>                          default = lead
>>>                          always = 1
>>>                          list = lead
>>>                  }
>>>              keepNonMatchedTags = 1
>>>      }
>>> }
>>> 
>>> [global]
>>> 
>>> 
>>> page = PAGE
>>> page.shortcutIcon = fileadmin/templates/images/favicon.ico
>>> page.meta.viewport  = width=device-width, initial-scale=1.0
>>> 
>>> 
>>> 
>>> page {
>>>      1 = FLUIDTEMPLATE
>>>      1 {
>>>          file = fileadmin/templates/BootstrapOWL/templates/template.html
>>>          partialRootPath = fileadmin/templates/BootstrapOWL/partials
>>>          layoutRootPath = fileadmin/templates/BootstrapOWL/layouts
>>> 
>>>      }
>>> 
>>>      includeCSS.bootCSS = fileadmin/templates/BootstrapOWL/css/bootstrap.css
>>>      includeCSS.carousel = fileadmin/templates/BootstrapOWL/css/caroussel.css
>>>      includeJSFooter.jquery = https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js
>>>      includeJSFooter.bootstrap = fileadmin/templates/BootstrapOWL/js/bootstrap.min.js
>>>      includeJSFooter.iewa = fileadmin/templates/BootstrapOWL/ja/ie10-viewport-bug-workaround.js
>>> 
>>>      variables {
>>>        hauptText < styles.content.get
>>>        hauptText.select.where = colPos=0
>>> 
>>>      }
>>> }
>>> 
>>> ----------------------
>>> 
>>> Eigentlich war ich sicher, dass die Stelle innerhalb von PAGE richtig ist. Muss ich das gegebenenfalls in den Ressourcen der Seite mitgeben und nicht in den Skripts?
>>> 
>>> <p> ist aktuell noch ohne Klasse...
>>> 
>>> 
>>> Danke Dir nochmal.
>>> 
>>> LG
>>> Heike
> 
> _______________________________________________
> TYPO3-german mailing list
> TYPO3-german at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german



More information about the TYPO3-german mailing list