CSS-Gestylte Tabellen in Typo3
Kategorie: Typo3, TutorialVon: Andreas Prucha
Wer mal den RTE per Page-TS soweit konfiguriert hat, dass er selbst definierte Klassen annimmt, braucht trotzdem noch ein paar Einstellungen im Template.
Ein Fallstrick bei Typo3 kann sein, dass Typo3 versucht vom Redakteur eingegebenen oder genierten HTML-Code bei der Ausgabe zu säubern. Eigentlich ziemlich erfreulich, nur leider führt die Säuberungsaktion nicht immer zum gewünschten Ergebnis.
Weg mit class="bodytext"
Standardmässig weist Typo3 allen Absätzen die CSS-Klasse bodytext zu. Das kann mit einer Zeile im Template-Setup leicht unterdrückt werden:
Template-Setup:# Ein P bleibt ein P und wird nicht zum P class="bodytext"
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.addAttributes.P.class >
Diese Zeile verhindert, dass bei Paragraph-Tags automatisch ein class=bodytext angehängt wird.
Im Editor angegebene Klasse bei Tabellen beibehalten
Standardmässig weist Typo3 einer Tabelle die Klasse contenttable zu, auch wenn im RTE der Tabelle eine andere Klasse zugewiesen wurde.
Mit folgenden Zeilen im Template-Setup lässt sich das verhindern:
Template-Setup:#
# Wenn einer Table im Editor eine Klasse zugewiesen wurde diese beibehalten
#
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.class.list >
Keine P's in Tabellenzellen generieren
Per default generiert Typo3 p-Tags um den Inhalt von im RTE eingegebenen Tabellen-Zellen. Mit lib.parseFunc_RTE.externalBlocks.table.HTMLtableCells.default >
im Template-Setup lässt sich verhindern, dass Typo3 Table-Zellen durch den Parser schickt und aufgrund der fehlenden Umschliessung mit P-Tags diese hinein generiert.
Da wirft allerdings das Problem auf, dass dann beispielsweie in einer Zelle eingegebene Links nicht mehr umgesetzt werden.
Dieses Problem lässt sich umgehen, indem man Typo3 anweist die Einstellungen von lib.ParseFunc zu übernehmen. Dadurch werden die Tags in Tabellen-Zellen geparst, ohne dass zuätzliche P-Tags generiert werden.
Template-Setup:# keine P in TD generieren aber trotzdem Inhalt parsen
lib.parseFunc_RTE.externalBlocks.table.HTMLtableCells.default >
lib.parseFunc_RTE.externalBlocks.table.HTMLtableCells.default.stdWrap.parseFunc =< lib.parseFunc

Kommentare


Thanks for writing such an easy-to-understand article on this topic.
That's a sharp way of thinking about it.
That's an inventive answer to an interesting question
This is exactly what I was looking for. Thanks for writing!
Well done article that. I'll make sure to use it wisely.
This is exactly what I was looking for. Thanks for writing!
I can't hear anything over the sound of how awesome this article is.
Gosh, I wish I would have had that information earlier!
I'm out of league here. Too much brain power on display!
There's a terrific amount of knowledge in this article!
Just what the doctor ordered, thankity you!
Superior thinking demonstrated above. Thanks!
Stay with this guys, you're helping a lot of people.
Wow, this is in every respect what I needed to know.
I was so confused about what to buy, but this makes it understandable.
Check that off the list of things I was confused about.
That insight would have saved us a lot of effort early on.
What a pleasure to meet someone who thinks so clearly
I came, I read this article, I conquered.
AFAIC that's the best answer so far!
BS low - rationality high! Really good answer!
Way to go on this essay, helped a ton.
Haha. I woke up down today. You've cheered me up!
IJWTS wow! Why can't I think of things like that?
Thanks for spending time on the computer (writing) so others don't have to.
Thinking like that shows an expert's touch
HHIS I should have thought of that!
Frankly I think that's absolutely good stuff.
You know what, I'm very much inclined to agree.
Dag nabbit good stuff you whippersnappers!
Keep these articles coming as they've opened many new doors for me.
Articles like this really grease the shafts of knowledge.
I love these articles. How many words can a wordsmith smith?
Great hammer of Thor, that is powerfully helpful!
That's the best answer by far! Thanks for contributing.
Thank God! Someone with brains speaks!
My hat is off to your astute command over this topic-bravo!
Your answer was just what I needed. It's made my day!
Very valid, pithy, succinct, and on point. WD.
And I thought I was the sensible one. Thanks for setting me straight.
Tip top stuff. I'll expect more now.
It's imperative that more people make this exact point.
How could any of this be better stated? It couldn't.
I much prefer informative articles like this to that high brow literature.
It's imperative that more people make this exact point.
That addresses several of my concerns actually.
That's a sharp way of thinking about it.
That's not just the best answer. It's the bestest answer!
Your posting lays bare the truth
Deep thinking - adds a new dimension to it all.
Wow, your post makes mine look feeble. More power to you!
That's an inventive answer to an interesting question
That's a crackerjack answer to an interesting question
AKAIK you've got the answer in one!
A good many valuables you've given me.
Heck of a job there, it absolutely helps me out.
That's really thinking out of the box. Thanks!
Action requires knowledge, and now I can act!
Thanks for contributing. It's helped me understand the issues.
You know what, I'm very much inclined to agree.
It's about time someone wrote about this.
Your articles are for when it absolutely, positively, needs to be understood overnight.
You got to push it-this essential info that is!
That's an ingenious way of thinking about it.
Wow, that's a really clever way of thinking about it!
Kudos to you! I hadn't thought of that!
No more s***. All posts of this quality from now on
Wow I must confess you make some very trenchant points.
It's a real pleasure to find someone who can think like that
Such an impressive answer! You've beaten us all with that!
Thanks guys, I just about lost it looking for this.
Wham bam thank you, ma'am, my questions are answered!
Hot damn, looking pretty useful buddy.
Cheers pal. I do appreciate the writing.
A few years ago I'd have to pay someone for this information.
It's a joy to find someone who can think like that
That's a brilliant answer to an interesting question
It's like you're on a mission to save me time and money!
If you're reading this, you're all set, pardner!
All of my questions settled-thanks!
Now I feel stupid. That's cleared it up for me
Just what the doctor ordered, thankity you!
At last! Someone with real expertise gives us the answer. Thanks!
You've impressed us all with that posting!
And to think I was going to talk to someone in person about this.
That's a brilliant answer to an interesting question
Your post has moved the debate forward. Thanks for sharing!
The purchases I make are entirely based on these articles.
Normally I'm against killing but this article slaughtered my ignorance.
The paragon of understanding these issues is right here!
This is way better than a brick & mortar establishment.
It's spooky how clever some ppl are. Thanks!
I am forever indebted to you for this information.
What's it take to become a sublime expounder of prose like yourself?
Pleasing to find someone who can think like that
Which came first, the problem or the solution? Luckily it doesn't matter.
This is way more helpful than anything else I've looked at.
Action requires knowledge, and now I can act!
AFAICT you've covered all the bases with this answer!