Using DirectPHP - intermixing PHP with HTML commands
|Written by kksou|
|Monday, 27 June 2011|
<table><tr> <td>test1</td> <td><?php echo $var1;?></td> </tr></table>
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:
<?php echo '<table><tr> <td>test1</td> <td>'; echo $var1; echo '</td> </tr></table> ?>';Or simply:
<?php echo "<table><tr> <td>test1</td> <td>$var1</td> </tr></table> ?>";
Bottom Line: Make sure you use only pure PHP statements with DirectPHP. No HTML statements.