Reputation: 469
Is it possible to wrap a value in HTML like the following example?
$email_message = ('somehtml', $emailtext, 'somemorehtml');
So that when it is run you get:
<html>
<head>
<style>body {color:#eee;}</style>
</head>
<body>
<p>Hello and welcome to our website</p>
</body>
</html>
Upvotes: 0
Views: 46
Reputation: 4304
it's possible but it's not the best practice. it would be better to do:
<html>
<head><style>body {color:#eee;}</style></head>
<body>
<p>Hello and welcome to our website, Mr <?php echo $name; ?></p>
</body>
</html>
do you absolutely need to echo your html?
Upvotes: 0
Reputation: 114367
You're looking for a templating system.
jQuery Templating - for doing it on the client
PHP TAL - for doing it with PHP on the server
Upvotes: 1
Reputation: 528
$msg = 'Hello and welcome to our website';
$body = '<html>
<head><style>body {color:#eee;}</style></head>
<body>
<p>' . $msg . '</p>
</body
</html>';
echo $body;
?
Upvotes: 3