Jump to content

[SOLVED] Embed html code in php script


aashcool198

Recommended Posts

No, you can either open and close php tags only where you require them or you can use the << EOH syntax as below

<?php
$html = <<< EOH
<p class="header">This is some text</p>
<p>$contentInAVariable</p>
EOH;

print $html;
?>

Alternatively you could use a template engine to completely separate the logic from the view. http://www.smarty.net

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.