I’m using a ckeditor in my intranet.
I use it to save formated text, like links, for example.
The thing is, what I have in the ckeditor source is
<p>
this is the new <a href="http://www.google.com">test</a> we need to run.</p>
and what I see in the editor is
test(as a link)
What gets saved in the DB is
<p>
this is the new <a href="http://www.google.com">test</a> we need to run.</p>
which is correct.
But when I want to edit it on ckeditor, what I see is
<p> <a href="http://www.google.com">test</a></p>
and what I see as source is
<p>
<a href="http://www.google.com">test</a></p>
I would like to see exactly the same when I edit it.
Anoter thing is, I’m using Html.Raw to display it in my index, but it shows me the html. I would like to see the rendered html.
So, if I save
<p>
this is the new <a href="http://www.google.com">test</a> we need to run.</p>
I want to see
this is the new test(as link) we need to run
and not
<p>
this is the new <a href="http://www.google.com">test</a> we need to run.</p>
Any ideas??
Rui Martins
Your problems are the not understanding of htmlentities.
Encoding HTML
http://php.net/manual/en/function.htmlentities.php
Decoding HTML
http://www.php.net/manual/en/function.html-entity-decode.php
Example usage both
Edit (Added asp.net equivalent)