The code below is a sample code of the top oh my php web page. There are php variables being outputted in specific places.
I'd to implement an HTML to PDF converter, but it requires me to put all of my code into a single variable that the PDF converter will use in its class. How can I put my existing into into a single variable say: $html
without having to open up all my PHP variables, escpaing everything and concatenating the whole place? I was thinking of using heredoc
syntax but it doesn't like the <?php ?>
and I'm sort of confused as I've never used it in the past. Any ideas on how to achieve this?
Ideally, this is what I'd like to do:
$html = <<<EOD
<div id="topHeaderView"><?php echo configuration::getValue(6); ?></div>
<table>
<tr>
<td><?php echo $lang["FAI_R"]["PRT"]["TITLE"]["HEADER"]; ?></td>
</tr>
EOD;
The above doesn't capture any values outputted by $lang["FAI_R"]["PRT"]["TITLE"]["HEADER"]
or by configuration::getValue(6)
.
Insead of:
$html = "";
$html .= "<div id=\"topHeaderView\">".configuration::getValue(6)."</div>";
$html .= "<table>";
$html .= "<tr>";
$html .= "<td>".$lang["FAI_R"]["PRT"]["TITLE"]["HEADER"]."</td>";
$html .= "</tr>";
This is something I want to avoid...