html - Include text from other files in PHP -


i want create email templates website.

my template

so let's template_header.php:

<html>     <head>         <title>             '.$email_subject.'         </title>     </head>     <body> 

and template_footer.php:

    </body> </html> 

the problem

as know can use output buffering include these templates. code:

<?php ob_start(); include "template_header.php"; ?> <p>text</p> <?php include "template_footer.php"; $message = ob_get_contents(); ob_end_clean(); ?> 

but doesn't work! $message empty! when var_export($message), don't anything!!! not empty string.

  • so problem code?
  • what other ways can include text?

this works me.

ob_start();  //print things - , mean print. echoing , plain html work. $message = ob_get_clean();  echo $message; 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -