I'm generating some html to be used with the MPDF php library for generating a PDF. But when I create some HTML with php which has a loop inside it, it cuts of the beginning of the string, here's my code:
$page = "<div class='A4'><h1>Test: lookbook</h1><p>";
$page .= $date;
$page .= "</p><div class='items'>";
while ($the_query->have_posts()) {
$the_query->the_post();
$page .= "<img src='";
$page .= get_field('product_image')['url'];
$page .= "'>";
}
$page .= "</div></div><div class='footer'>A Story in every gemstone</div>";
echo $page;
Running the above code returns:
1<img src='urltoimage'></div></div><div class='footer'>A Story in every gemstone</div>
So it looks like everything before the while loop is being cut out.