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

R. van Twisk typo3 at rvt.dds.nl
Fri Mar 24 23:45:17 CET 2006


Marlies C wrote:
> 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
hey marlies,

i did see the same answer on a other thread, btw great website you 
have.. ith helped me a lot about 16 months ago learning typo3..

However, when I use the pre tag it get's added on every line, not simply 
on all selected text.

I can do two things:L
1) teach RTE/typo3 to add one pre tag and tell it to honor a class to it
2) Teach RTE/Typo3 not to parse my html upon save and or retreival to 
and from the DB

When I paste it into the RTE all looks beautifull it's just when it 
get's saved it fails.

Ries






More information about the TYPO3-project-rte mailing list