Using DirectPHP - intermixing PHP with HTML commands
Written by kksou   
Monday, 27 June 2011

Many people have posts questions in the forum why the following does not work with DirectPHP:

<td><?php echo $var1;?></td>

DirectPHP uses PHP's plain old eval() function to process your PHP commands.

For those who have used eval(), the function can only process pure PHP commands. In a typical PHP page, you can freely intermix PHP and HTML commands. However, for the eval() function, it cannot process commands that include both PHP and HTML. It only understands PHP, not HTML.

Because DirectPHP uses eval(), so naturally it will not process codes with a intermix of PHP and HTML commands such as the codes above.

As a workaround, you can easily include HTML commands within PHP using the echo() function. So, to run the above code in DirectPHP, you can change the code to:

echo '<table><tr>
echo $var1;
echo '</td>
Or simply:
echo "<table><tr>

Bottom Line: Make sure you use only pure PHP statements with DirectPHP. No HTML statements.

< Prev   Next >

Blog - Forum - Privacy Policy - Contact Us
Copyright © 2006-2012. All Rights Reserved