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

lists at berlin-typo3.de lists at berlin-typo3.de
Sun Jan 13 21:17:14 CET 2019


Hallo Heike,

Habe selbst noch einmal herumprobiert.

So geht’s:

### TypoScript Setup

lib.parseFunc_ColPos_0 < lib.parseFunc_RTE
lib.parseFunc_ColPos_0 {
	nonTypoTagStdWrap {
      		HTMLparser {
                    	tags.p.fixAttrib.class {
                        	default = lead
                        	always = 1
                       	 	list = lead
                    	}
                    	keepNonMatchedTags = 1
		}
    	}
}

### Typoscript Constants

# 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}<1">
   <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>


VG Birgit


> Am 13.01.2019 um 16:39 schrieb Heike Herzog-Kuhnke <hhk at kuhnke-owl.de>:
> 
> Hmhhhh,
> 
> also die Klasse wird wunderbar hinzugefügt, aber...
> Zwischen allen <p class="lead">..</p> wird ein <p>&nbsp;</p> eingefügt und irgendwie werden Links nicht mehr umgesetzt.
> 
> Das ist ja gemein :(
> Im Editor sehe ich nichts unauffälliges auch wenn ich den Quellcode ansehe.
> 
> Muss ich die Umsetzung der Links noch zusätzlich in das typoskript einfügen? Ich dachte, dass mit der Zeile:
> 
> lib.parseFunc_ColPos_0 < lib.parseFunc_RTE
> 
> .. alles, was in der lib.parsFunc_RTE steht einfach in die neue lib übertragen wird und ich sie mit den Folgezeilen nur erweitere...
> 
> Ich hab zum Testen zwischenzeitlich mal alle möglichen Varianten ausprobiert, ob mit weniger Zeilen und Verschachtelungen die zusätzlichen <p> wieder verschwinden, aber irgendwie ist entweder alles weg, oder wenn <p class="lead"> eingefügt ist, dann sind auch die Zusatzzeilen da.
> 
> Dass die Links nicht mehr umgesetzt werden verstehe ich auch nicht so ganz. Muss ich die Umsetzung der Links explizit mit hinein nehmen?
> 
> Die Abfrage der colPos scheint typo3 auch relativ kalt zu lassen:
> 
> <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>
> 
> Statt bei einem Element mit colPos 10 / 20 / 30 ein normales <p> einzufügen, wird auch hier <p class="lead"> eingesetzt...
> 
> 
> LG
> Heike
> 
> 
> Am 13.01.19 um 08:15 schrieb Heike Herzog-Kuhnke:
>> Birgit,
>> Du bist die Heldin des Tages heute :)
>> Vielen Dank. So hat es funktioniert.
>> Ich habe die Lib in mein Typoskript vor PAGE eingefügt und dann in dem Template für Text die Fluid-Template Zeilen eingefügt und schon macht er das was er soll.
>> Tausend dank. Das sieht klasse aus und ich habe das Gefühl wieder ein wenig mehr verstanden zu haben :)
>> Falls Du mal irgendwann in der Nähe von Augsburg unterwegs sein solltest, dann melde Dich. Du hast was gut.
>> LG
>> Heike
>> Am 12.01.19 um 19:39 schrieb Birgit:
>>> Nachtrag:
>>> 
>>> ich hatte vergessen zu kennzeichnen:
>>> 
>>> ### Typoscript Constants
>>> 
>>> # 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
>>> 
>>> }
>>> 
>>> VG Birgit
>>> 
>>>> Am 12.01.2019 um 19:36 schrieb Birgit <lists at berlin-typo3.de>:
>>>> 
>>>> 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
>>>> 
>>> 
> 
> _______________________________________________
> 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