When you post some code this is what happens:
1. You write your text and paste code into tinymce editor
2. Tinymce encode < and > to < and >
3. You save your post, and < and > get stored in the db
4. Problem: when you re-edit your post, the textarea which tinymce
reads the content from translate < and > back to < and >
5. Solution: double escape < and > to &lt; and '&gt;
before reading date from db into form.
Use this line in you controller:
$this->data['Post']['body'] = preg_replace(array('/\</i', '/\>/
i'), array('&lt;', '&gt;'), $this->data['Post']['body']);
BTW this is my config of tinymce:
<?php echo $javascript->link('tiny_mce/tiny_mce'); ?>
<script language="javascript" type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode: "exact",
elements : "data[Post][body]",
relative_urls : false,
extended_valid_elements : "iframe[src|width|height|name|align|
frameborder]",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "center",
entity_encoding : "named",
add_unload_trigger : false,
convert_urls : false,
content_css : "<?php echo $this->base; ?>/css/core.css?" + new
Date().getTime(),
preformatted : true,
apply_source_formatting : true,
cleanup : false,
verify_html : false
});
</script>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---