---
title: "RTE nonWrappedTag <p> tag nicht um <div>"
url: "https://www.typo3.net/d/88811-rte-nonwrappedtag-p-tag-nicht-um-div"
source: "typo3.net"
tags: ["Backend","RTE & CKEditor","Frage"]
created: "2009-04-11"
last_reply: "2009-04-16"
replies: 1
solved: false
page: 1
pages: 1
lang: "de"
---

# RTE nonWrappedTag <p> tag nicht um <div>

Backend › RTE & CKEditor · 1 Antwort · gestartet 2009-04-11

## Eröffnungsbeitrag

**xTheTronx** · 2009-04-11 · [Beitrag #1](https://www.typo3.net/d/88811-rte-nonwrappedtag-p-tag-nicht-um-div/1)

Hallo,

da hatte ich gedacht, dass ich mein Problem gelöst hätte, siehe meinen vor kurzem geschlossenen Post.

[/d/88808-rte-div-wird-von-p-tags-umschlossen](https://www.typo3.net/d/88808-rte-div-wird-von-p-tags-umschlossen)

In meiner Euphorie habe ich mir dummerweise die Seite nicht noch mal genauer angesehen, denn das Auskommentieren von nonWrappedTag entfernt nicht nur das <p> Tag um das <div>, sondern leider auch überall sonst. Somit das klassische Beispiel, das Kinde mit dem Bade auszuschütten.

Ich habe jetzt schon alle möglichen Konstellationen durch, aber leider ohne Erfolg.
Ich habe nochmal den Quellcode geposten, den mir Typo3 z.Z. liefert.

Ich bin für jede Anregung dieses Problem zu lösen dankbar!

Gruß

Torsten

Das Code-Highlighting funktioniert innerhalb HTML anscheinend nicht. alles was in den  Tags steht, soll weg.

```html
<!--  CONTENT ELEMENT, uid:1999/text [begin] -->
<a id="c1999"></a>
	<!--  Text: [begin] -->
[u]<p>[/u]<div class="drei-bilder-container"><p class="drei-bilder"><img src="/images/dummy-bild.gif" alt="" width="150" /> Lorem ipsum </p>
[u]</p>[/u]
	<p class="drei-bilder"><img src="/images/dummy-bild.gif" alt="" width="150" /> Lorem ipsum dolor sit amet,</p>
	[u]<p>[/u]<p class="drei-bilder bild-rechts"><img src="/images/dummy-bild.gif" alt="" width="150" /> Lorem ipsum </p>
</div>

In css_styled_content steht das

[u]</p>[/u]
<p>Text nach Bild</p>
		<!--  Text: [end] -->
```

```typoscript
	nonTypoTagStdWrap.encapsLines {
		//encapsTagList = div,p,pre,h1,h2,h3,h4,h5,h6
		encapsTagList = img,p,pre,h1,h2,h3,h4,h5,h6
		nonWrappedTag = P
		remapTag.DIV = 
		innerStdWrap_all.ifBlank =  
		addAttributes.P.class = bodytext
		addAttributes.P.class.setOnly=blank
	}
```

## Antworten

### [#2](https://www.typo3.net/d/88811-rte-nonwrappedtag-p-tag-nicht-um-div/2) · xTheTronx · 2009-04-16

Also, ich versuche mich ja wirklich mit dem RTE anzufreunden! Dies scheint aber nicht auf Gegenseitigkeit zu beruhen! #evil#

Ich habe wieder viel getestet und dachte auch wieder, dass ich eine Lösung gefunden hätte, nämlich innerhalb von <div> nicht mehr mit <p>-Tags zu arbeiten, sondern diese durch <div> zu ersetzen.

Schien auch soweit zu funktionieren, aber die Vergangenheit hat ja gezeigt, nicht zu früh zu jubeln, wie auch diesmal.

Arbeite ich so, geht es:

```html
<div class="drei-bilder-container">
	<div class="drei-bilder">
		<img src="http://dummy-bild.gif" width="150" />
		Lorem ipsum dolor ...
	</div>
</div>
```

Kommt aber z.B. eine Überschrift hinzu

```html
<div class="drei-bilder-container">
	<div class="drei-bilder">
		<img src="http://dummy-bild.gif" width="150" />
		<h1>testen</h1>Lorem...
	</div>
</div>
```

```html
<p><div class="drei-bilder-container">
<div class="drei-bilder">
<img src="http://dummy-bild.gif" alt="" width="150" /> 
</p>
<h1>testen</h1>
<p> Lorem ipsum ...</div>
</p>
</div>
</div>
```

Ich habe auch versucht, innerhalb der Klasse t3lib_parsehtml_proc.php, wie in unterem Post beschrieben, mal das Div dazu zu schreiben, aber ohne Ergebnis.

<http://lists.netfielders.de/pipermail/typo3-german/2008-July/049184.html>

Ich meine auch noch in einem Post gelesen zu haben, dass die <p> nun wieder eingefügt werden, da Typo3 die Verschachtelung nicht erkennt und diese deshalb als Absätze werten würde?!

Mir gehen so langsam wirklich die Ideen aus und ich habe keine Ahnung, wonach ich noch suchen soll.
Mir würde es jetzt fast schon reichen, wenn ich dem RTE, für diesen speziellen Fall einfach sagen könnte, dass die Inhalte ohne Filterung in die DB rein kommen. Dazu habe ich aber auch nichts gefunden.

Ich poste nochmal zusätzlich meine TSconfig und TS-Setup Einstellungen. Vielleicht fällt ja jemandem was auf, was ich übersehen habe.

Vielen Dank

```typoscript
## RTE Konfiguration
RTE.default {
  # Frontend-Editierung aktivieren
  useFEediting = 1
        
  ## Markup options
  enableWordClean = 1
  removeTrailingBR = 1
  removeComments = 1
  removeTags = center, sdfield
  removeTagsAndContents = style,script

  proc {
    # DIV-Tags als DIV belassen und nicht in P umwandeln
    remapParagraphTag = div
          
    # tags die erlaubt / verboten sind
    allowTags = table, tbody, tr, th, td, h1, h2, h3, h4, h5, h6, div, p, br, span, ul, ol, li, re, blockquote, strong, em, b, i, u, sub, sup, strike, a, img, nobr, hr, tt, q, cite, abbr, acronym, center
                denyTags = font

    # br wird nicht zu p konvertiert
    dontConvBRtoParagraph = 1

    # tags sind erlaubt außerhalt von p, div
    allowTagsOutside = img,hr                

    # erlaubte attribute in p, div tags
    keepPDIVattribs = align,class,style,id 

    # html parser einstellungen
    HTMLparser_rte {
      # tags die erlaubt/verboten sind
      allowTags < RTE.default.proc.allowTags
      denyTags < RTE.default.proc.denyTags

      # tags die untersagt sind
      removeTags = font

      # entfernt html-kommentare
      removeComments = 1

      # tags die nicht übereinstimmen werden nicht entfernt (protect / 1 / 0)
      keepNonMatchedTags = 0
   }

   # Content to database
   entryHTMLparser_db = 1
   entryHTMLparser_db {
     # tags die erlaubt/verboten sind
     allowTags < RTE.default.proc.allowTags
     denyTags < RTE.default.proc.denyTags

     # CLEAN TAGS
     noAttrib = b, i, u, strike, sub, sup, strong, em, quote, blockquote, cite, tt, br, center

     rmTagIfNoAttrib = div,span,font

     # htmlSpecialChars = 1
        
     ## align attribute werden erlaubt
       tags {
         p.fixAttrib.align.unset >
         p.allowedAttribs = class,style,align
         div.fixAttrib.align.unset >
         hr.allowedAttribs = class

        # b und i tags werden ersetzt (em / strong)
        b.remap = strong
        i.remap = em

        ## img tags werden erlaubt
        img >
      }
    }
  }
}

# Use same processing as on entry to database to clean content pasted into the editor
RTE.default.enableWordClean.HTMLparser < RTE.default.proc.entryHTMLparser_db

# Breite des RTE in Fullscreen-Ansicht
TCEFORM.tt_content.bodytext.RTEfullScreenWidth= 80%
```

```typoscript
TS-Setup
  parseFunc_RTE {
    #--- RTE Tuning
    nonTypoTagStdWrap.encapsLines {
      nonTypoTagStdWrap >
      addAttributes.DIV.class >
      remapTag.DIV = DIV 
      encapsTagList = div,p 
      addAttributes >  
      # Keine Klasse für Standardabsätze
      addAttributes.P.class =
      #addAttributes.P.class >
      # Keine Umwandlung von Tags
      remapTag >
      encapsLines >
      # HTML-Tags, die nicht mit einem zusätzlichen <p>wrap umgeben werden dürfen
      # DO NOT WRAP THOSE TAGS WITH <p>
      encapsTagList = br, cite, div, p, pre, hr, h1, h2, h3, h4, h5, h6, table      
    }
  
    # COPY ALLOW TAGS FROM PAGETS (WITHOUT b, i, link) sometimes there is a probblem with multiline so just use one line
    allowTags = script, a, abbr, acronym, address, blockquote, br, caption, cite, code, div, em, embed, h1, h2, h3, h4, h5, h6, hr, img, li, object, ol, p, param, pre, q, span, strong, sub, sup, table, tbody, td, th, tr, tt, ul
        
    # table handling
    table.stripNL = 1
    table.stdWrap.HTMLparser = 1
    table.callRecursive = 1
    table.callRecursive.tagStdWrap.HTMLparser = 1
    table.stdWrap.HTMLparser.keepNonMatchedTags = 1

    # Do NOT add any unwanted p elements in table cells, and do NOT remove any p-elements that have been added by authors!
    table.HTMLtableCells = 1
    table.HTMLtableCells.default.stdWrap.parseFunc =< lib.parseFunc  
    externalBlocks = div
    
    ## make DIV an externalBlocks.tag and call parseFunc_RTE recursivly
    #externalBlocks.div.callRecursive = 1
    #externalBlocks.div.callRecursive = 0
    
    # avoid unwanted p-elements in th/td on the way to FE
    externalBlocks.table.HTMLtableCells.default >
    externalBlocks.table.HTMLtableCells.default.stdWrap.parseFunc =< lib.parseFunc
	
    # DO NOT ADD class="contenttable" TO EVERY TABLE => ALLOW COSTUM class
    externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.class  >
	
    # DO NOT AUTOLINK EVERY STRING THAT STARTS WITH HTTP OR MAILTO
    # such strings in the content are assumed to be intentional
    # makelinks >
    # externalBlocks.ul.stdWrap.parseFunc.makelinks = 0
    # externalBlocks.ol.stdWrap.parseFunc.makelinks = 0
  }

  # function to allow custom link attributes
  parseFunc.tags.a = COA
  parseFunc.tags.a {
    // Parsing of A tag if not an anchor
    10 = TEXT
    10.current = 1
    10.required = 1	// Remove empty links
    10.typolink.parameter.data = parameters : allParams
    10.typolink.parameter.postUserFunc = user_tinymce_rte->getHref
    10.typolink.ATagParams.data = parameters : allParams
    10.typolink.ATagParams.postUserFunc = user_tinymce_rte->getATagParams
    10.if.isTrue.data = parameters : allParams
    10.if.isTrue.postUserFunc = user_tinymce_rte->isNotAnchor

    // Parsing of A tag if an anchor
    20 = TEXT
    20.current = 1
    20.dataWrap = <a {parameters : allParams}>|</a>
    20.if.isTrue.data = parameters : allParams
    20.if.isTrue.postUserFunc = user_tinymce_rte->isNotAnchor
    20.if.negate = 1
  }
 
  parseFunc_RTE.tags.a < lib.parseFunc.tags.a

  // Remove empty links
  parseFunc.tags.link.required = 1
  parseFunc_RTE.tags.link.required = 1

  # allow all values in the FE
  parseFunc.denyTags =
  parseFunc_RTE.denyTags =  
}
```

########## BREAK #################
So, während ich das hier eingestellt habe, habe ich noch eine kleine Zeile ausprobiert, die mir **unter vorbehalt** anscheinend geholfen hat.

Da ich mir jetzt so viel Mühe mit dem Schreiben hier gegeben habe, muss der geneigte Leser, das halt alles lesen, ist aber für´s Nachvollziehen vielleicht nicht verkehrt. ;)

Also: Das ist mein heutiger Star!!

```typoscript
externalBlocks = div
```

Ob er das bleibt, wird sich zeigen und ich hoffe sehr, dass ich diesen Threat hier nicht noch mal befeuern muss...

Gruß

Torsten

---

Quelle: „RTE nonWrappedTag <p> tag nicht um <div>“, typo3.net, https://www.typo3.net/d/88811-rte-nonwrappedtag-p-tag-nicht-um-div
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
