View Full Version : How to put a html block into a $var
07-03-2007, 04:47 AM
I was wondering how can I put a html block into a $var.
07-03-2007, 06:41 AM
Is this what you're talking about?
$html = '<div>This is HTML</div>';
07-03-2007, 07:03 AM
You may also want to look into heredoc syntax (http://us.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc).
07-03-2007, 08:44 AM
You can also try Output Buffering - something I use a lot, especially for those heavily templated websites.
<?php ob_start(); ?>
<p>I hope this helps you</p>
<?php $var = ob_get_contents(); ob_end_clean(); ?>
# manipulate $var here
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.