Too much of my day has been spent trying to find out a good way to show source code on my TYPO3 pages. 

I figured I could just edit the RTE configuration to allow <code> tags or something, but configuring the RTE is a mysterious mess in TYPO3. I've taken advice from a lot of forum and newsgroup threads on what kind of configuration settings I should put in my page TS, but none of the various configuration snippets I've seen are flawless.

I just want to have TYPO3 display some HTML, PHP, or typoscript code, just the way I paste it in the RTE. Perhaps I need to RTFM some more than I already have.

Until then, the most reliable way to display code snippets is to just use the "Plain HTML" content element. All I have to do is take my code and run it through an online html escaper, and then I can put it in a "Plan HTML" content element after wrapping it with some <pre> and <code> tags. 

It really should be that difficult.

Here's what it looks like after I've escaped some PHP code and pasted it in a "Plain HTML" content element:

<pre><code>&lt;?php

$message = 'This is my message';
echo $message;

?&gt;</code></pre>
Share

Comments (0)

No comments found!

Write new comment