[TYPO3-RTE] Can't paste simple php/html code

Marlies C marliesc_spam at hotmail.com
Fri Mar 24 15:55:48 CET 2006


R. van Twisk wrote:
> hey RTE users,
> 
> 
> in htmlarea I want to paste a little bit of HTML/PHP code.
> When I paste it it all looks ok, but when saved to the database and 
> shown again all looks horrible and changed.
> 
> How can I tell htmlarea to respect my code and not change it from good 
> to bad when it was good in the beginning?
> 
> When I use preformated, then every line is pre-formatted which is not my 
> intention. Because I want to put it in a p tag with a class = code, 
> something like this:
> 
> <p class="code">
> .....my file....
> </p>
> 
> The code class makes a nice ident and puts a box around the code in 
> courier.
> 
> Below the code I tried to paste:
> 
> Ries
> 
> 
> 
> <?php
> 
> define(DOMAINNAME, 'http://www.rvantwisk.nl/');
> 
> class    user_pagenotfound {
> 
>     function pagenotfound($param, $conf) {
>     $toReplace = array('_', '-', '/', '.');
>     $url = trim(str_replace($toReplace,' ',$param['currentUrl'] ));
>     $url = trim(str_replace('index.php', '', $url));
>     $url = trim(str_replace('index%20php', '', $url));
>     $url = trim(str_replace('search', '', $url));
>     $url = "search/$url/";
>     header("HTTP/1.0 404 Not Found");
>     print '<!DOCTYPE html
>      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <head>
> <title>Page not Found!</title>
> <SCRIPT LANGUAGE="JavaScript">
> <!--
> function doRedirect() {
>     window.location="'.DOMAINNAME.$url.'";
> }
> 
> setTimeout("doRedirect()", 1000);
> // -->
> </script>
> 
> </head>
> <body style="font-family: Verdana, Geneva, Arial, Helvetica, 
> sans-serif;text-align:center;";>
> <p style="font-size:20px;text-align:center">The page you have requested 
> cannot be found</p>
> <p>If you are not automaticly redirected in 3 seconds please click here: 
> <br />
> <br /><a href='.DOMAINNAME.$url.'>'.DOMAINNAME.$url.'</a></p>
> </body>
> </html>';
> exit;
> }
> }
> 
> ?>

 From my experience the only way I can paste code into the RTE is use 
<pre> as the class around it. So all you would have to do is format 
<pre> to reflect your class="code".

Hope this helps.

Marlies
www.mcuniverse.com



More information about the TYPO3-project-rte mailing list