What is the best way to separate your PHP from HTML?

index.php
<?php
/*
PHP Code here
*/
$this = true;

// extension doesn't matter, make one up or use .html
include header.phtml
include body.phtml
include footer.phtml
?>

body.phtml
<div>
<!-- SWITCH <?php if ($this == true) { ?> -->
This is true
<!-- ELSE <?php } else { ?> -->
This is not true
<!-- END SWITCH <?php } ?>
</div>
 
Back
Top