CodeIgniter Forums
Active record + wysiwyg - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Active record + wysiwyg (/showthread.php?tid=38949)

Pages: 1 2


Active record + wysiwyg - El Forum - 02-24-2011

[eluser]Peter Pumpkineater[/eluser]
Hi,

Im a bit stuck now. I have a simple form with wisiwyg editor on textearea and I want to save its content to db using active record.
Problem is that all html tags gets escaped.
How can I avoid it?

Thnx


Active record + wysiwyg - El Forum - 02-24-2011

[eluser]exodus7[/eluser]
can you post your code so we can see how your implementing it?


Active record + wysiwyg - El Forum - 02-24-2011

[eluser]beaufrusetta[/eluser]
Which WYSIWYG are you using? It shouldn't be escaping the HTML - but if we could see a snapshot of your code, that'd be fantastic. :-)


Active record + wysiwyg - El Forum - 02-24-2011

[eluser]InsiteFX[/eluser]
Active Record, Insert and Update.
Note: All values are escaped automatically producing safer queries.

InsiteFX


Active record + wysiwyg - El Forum - 02-24-2011

[eluser]Peter Pumpkineater[/eluser]
It regular form -> form valiation (wysiwyg field has trim and required rules) and simple insert/update at the very end.
I end up with something like this
Quote:SDa & l t ;br& g t ;sdsasd& l t ;br& g t;a asd& l t ;br& g t ;
(I added spaces to display it properly) in db...
So I guess its not escaped but url encoded...


Active record + wysiwyg - El Forum - 02-24-2011

[eluser]InsiteFX[/eluser]
This may help you.

PHP.net - htmlentities

InsiteFX


Active record + wysiwyg - El Forum - 02-25-2011

[eluser]Peter Pumpkineater[/eluser]
Thank you IsiteFX, but I know I can decode it.
What I would like to achieve is to save pure HTML to database.


Active record + wysiwyg - El Forum - 02-25-2011

[eluser]LuckyFella73[/eluser]
You didn't mention which editor you are using. Usually you can
set a flag in the config file to prevent the output to be
converted.

In CK Editor you would set:
Code:
config.entities = false;



Active record + wysiwyg - El Forum - 02-26-2011

[eluser]Peter Pumpkineater[/eluser]
It is called wysiwyg jquery plugin, but Firebug shows that this particular field is submited as pure html. So either Firebug decode entiteis on the fly or it is changed in form validation or/and in db driver...


Active record + wysiwyg - El Forum - 02-28-2011

[eluser]LuckyFella73[/eluser]
I don't know that jquery plugin so I can't say how to configure that ...
But CI doesn't convert into entities - active record just escapes your
input but that is not your problem.
If you don't get it to work with that plugin you could use CKEditor for
example and show/hide the rte with jquery in case you don't want to display
it by default.