Dilema, Blocks of HTML within PHP

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I need to be able to have a large block of HTML code inside a PHP
document, assign it a variable, and use other variables, functions, and
objects within the HTML code still.


I have the following code (as an example):

$variable = <<<HTML
       <tr><td>echo $config->getBlah()</td></tr>

I need to be able to do that ^, that actual code wouldn't work, but it
is an example of what I need to do. I have tried searching for the <<<
operator, or whatever it is, the problem is most search utilities won't
recognize <<<, so it is really really hard to search and find answers
about it, I can't find anything about it on the php manual, I'm falling
onto a last resort by posting on some forums to see if anyong is able
to help me.

So question being really:
Is there a way I can split that so it recognizes those lines as PHP and
not part of the block of HTML code
Is there another method that I can use to achieve this same effect ?

I have to be able to keep the block of code together, not seperating
each line into a variable declaration. such as:
$var  = "<tr><td>" . $text . "</td></tr>";
$var .= "<tr><td>" . echo $config->getBlah(); . "</td></tr>";
Do NOT want to do that.

So if anyone has any ideas/solutions, please, please let me know :)


Re: Dilema, Blocks of HTML within PHP

For anyone else that may be interested, I was able to get an answer to
my question.
Here would be the syntax of what I need to do:

$variable =<<<HTML

Re: Dilema, Blocks of HTML within PHP

The ability to insert code into HTML is the raison d'etre of PHP.


Site Timeline