This post doesn't exist anymore!

WYSIWYG editor and PHP code

Feed 7 posts, 3 voices

Avatar
12 posts

Hi there,

I’m struggeling a bit, because on the sites I have with frog as a CMS I have some users that doesn’t know much about HTML. They do of course use a WYSIWYG editor (currently using tinymce). My problem is that I need to be able to insert some PHP code into these sites, but tinymce always strips it out when they use it. So I get a lot of broken links around the page.

The reason I need PHP code in the content is because we do a lot of A/B testing and moving pages around. We normally do the testing on a site we only drive PPC traffic to and once we have the results we upload it to the main site. That’s why it’s important that it’s flexible.

So to make it short: How can I get a WYSIWYG editor that doesn’t filter PHP code?

 
Avatar
486 posts

You might give this a try.

Otherwise use the Markdown or Textile filter.

 
Avatar
12 posts

Does that allow you to add php with a WYSIWYG editor?

Markdown or Textile is not an options for the other guys that use the CMS on this site..

 
Avatar
12 posts

I see that it’s no longer getting stripped out, but it’s not really any easy ways for the WYSIWYG users to add it..

 
Avatar
651 posts

My general opinion is that any not able to use stuff like markdown or textile has no business programming PHP. :-)

I know.. probably doesn’t help you. But hopefully makes you think. If they’re so bad at textile/markdown, how bad are their PHP programming skills? They can potentially wreck your site with a single mistake.

If they do know how to program PHP… they’re just being lazy? :-p

 
Avatar
12 posts

They don’t do any programming at all, they just update their site once in a while. It’s a company site :)

 
Avatar
486 posts

cypherus,
what might work for you is if you insert the PHP code into a separate page part that doesn’t use any filter. Tell your users to not mess with that page part. This way they can still edit the body using the WYSIWYG, and you can call the part from the layout.

 
Avatar
651 posts

Keep in mind… if you have a page which contains only PHP code, you can “protect” it (see the checkbox on the page) and prevent non-administrator users from editing it.