Yes, clearly part of the problem is the way its rendered by the browser. So I thought about encasing the {} tags before sending to FCKeditor and removing afterwards before saving. Seems to work.
Before given to editor: $contents = preg_replace("/^({.*})\n$/smU", "<pre class=\"tpl\">\\1</pre>\n", $contents);
Before save: $contents = preg_replace("/^<pre class=\"tpl\">({.*})<\/pre>/mU", "\\1\n", $contents);
This is nice because it also lets me put the tags in a different color. Only real problem I can see is that FCKeditor seems to be converting newlines to <br /> even when they are within <pre> tags. Anyone have ideas to get around that?
RE: Retaining new lines of source
RE: Retaining new lines of source
Before given to editor:
$contents = preg_replace("/^({.*})\n$/smU", "<pre class=\"tpl\">\\1</pre>\n", $contents);
Before save:
$contents = preg_replace("/^<pre class=\"tpl\">({.*})<\/pre>/mU", "\\1\n", $contents);
This is nice because it also lets me put the tags in a different color. Only real problem I can see is that FCKeditor seems to be converting newlines to <br /> even when they are within <pre> tags. Anyone have ideas to get around that?