I want to create templates for my website.
My template
So let's say this is mine template_header.php:
<html>
<head>
<title>
'.$email_subject.'
</title>
</head>
<body>
And this is mine template_footer.php:
</body>
</html>
Problem
As I know, I can use output buffering to include these patterns. This is my code:
<?php
ob_start();
include "template_header.php";
?>
<p>Text</p>
<?php
include "template_footer.php";
$message = ob_get_contents();
ob_end_clean();
?>
But that will not work! $messageis empty! Even when I do var_export($message), I get nothing !!! Even an empty string.
- What is the problem with my code?
- What other ways can I include my text?
source
share