开发者

Drupal 6.x php input format

Updating an inherited drupal site and I'm trying to add php code to the content body using the WYSIWYG editor. I change the editor to source view and use <?php ?> tags. I also choose php code as the input format, and save the page.

When the page is rendered, I see the code on the page.

If I return and edit the page, the code has now changed to <!--?php and ?&gt;

Is there a way, other than updating the database directly, to input PHP code and hav开发者_JAVA技巧e it remain unaltered so it is parsed properly?


Sounds like a problem with the way your WYSIWYG editor is set up. Which module is it?

The WYSIWYG editor should be set so that it doesn't load at all if the PHP input format is used. In addition, you might want to check your "HTML Corrector" settings -- it can be set to fix "broken" HTML automatically upon submit. But that's probably not what you want at all if you're writing PHP.


turn off javascript in your browser when editing that page. that should prevent the wysiwyg from altering the body content. i typically disable wysiwyg on my super user account, because they almost always break php.

"HTML corrector" settings should not be applied to the PHP code input format. As long as you are able to select that then there shouldn't be any server-side alterations of your body content.

for D6 -- the PHP filter settings should be reachable from the /admin/settings/filters page. make sure that php processing is the only thing going on with that filter.

then, if you can't easily get rid of the WYSIWYG on that field in the WYSIWYG settings, and it's screwing with your php (FCKEditor and YUI both do this, CKEditor is better, but what WYSIWYG isn't buggy!?), easiest way around is to disable javascript...


Apologies if this is not the answer you were looking for, but bear in mind that best practice is not to use a WYSIWYG editor when you're entering PHP, precisely because you don't want it to garble your code like this (or reveal it to anyone reading your site).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜