PHP Code inside WYSIWYG field

4 posts by 2 authors in: Forums > CMS Builder
Last Post: December 17, 2009   (RSS)

Is it possible to include PHP code inside the TinyMCE editor? There are places within the body that we need to reference PHP includes or data on a page-by-page basis. If not, would a template engine like Smarty Template be an alternative to replace special tags to be parsed later?

Re: [goodonyx] PHP Code inside WYSIWYG field

By Dave - December 11, 2009

Hi goodonyx,

It is possible, but we really really don't recommend it as it opens up security issues (anyone with CMS access can execute code) and makes the CMS usage more complex. If you know that and want to do it anyway then check out this tinymce plugin: http://sourceforge.net/tracker/index.php?func=detail&aid=2859676&group_id=103281&atid=738747

An alternative is a tag or placeholder system and replacing those tags or placeholders with code or values in the viewers.

That way you can write security checks into the replacement code and give people access to do some things (by including tags) but not anything and everything (by writing PHP).

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] PHP Code inside WYSIWYG field

Thanks Dave.

I was able to incorporate a PHP template parser from here:

http://www.devshed.com/c/a/PHP/Building-a-Template-Parser-Class-with-PHP-Part-I/