Web Services Blog

Add inline PHP to your pages

Say you want the following code in the content area of your page:

id = 300;

echo $app-id;

for($i=1; $i<=10; $i++){
echo "$i
";
}
?>

However, after you submit, the WYSIWYG converts the code to this:

<?php
echo "this is just a test";

$app->id = 300;

echo $app-id;

for($i=1; $i<=10; $i++){
echo "$i
";
}

?>

To prevent this, we will add // at end.

<?php
// id = 300;

echo $app-id;

for($i=1; $i<=10; $i++){
echo "$i
";
}
// -->
?>

This is very similar to the old way of tags, but the current version of the wysiwyg editor doesnt always support it correctly.