How can PHP code be properly displayed and executed within a template?
To properly display and execute PHP code within a template, you can use the `<?php ?>` tags to encapsulate your PHP code. Make sure that your template file has a `.php` extension so that the PHP interpreter can process the PHP code within it. Additionally, ensure that your web server is configured to interpret PHP code.
<!DOCTYPE html>
<html>
<head>
<title>PHP Template Example</title>
</head>
<body>
<h1>PHP Code Execution</h1>
<?php
$message = "Hello, World!";
echo "<p>$message</p>";
?>
</body>
</html>