Go to Content
Columbia College Chicago
Protect your PHP
Print this Page Email this Page

Protect your PHP

« Get rid of old bold or italics - Clear Formatting | Main | colorScheme for stand-alone sites »

January 22, 2007

Protect your PHP

Embedded PHP can be stripped from the source of a file if you edit the file using the graphical mode ("Edit") instead of the source view ("Source"). When you add PHP script to the source view of a page for the first time wrap it in <cmignore> tags like this:

<cmignore><?php echo 'test'; ?></cmignore>

Formatting may still get messed up, but your code will remain intact. Code on multiple lines may be re-flowed so that it's all on one line, which means that comments within the PHP should use

/* this notation style */
/* of comments */

instead of

// this notation style
// which will break your PHP
// when these four lines are pushed
// into one line.

Posted by root at January 22, 2007 4:21 PM | TrackBack