I'm stuck on this issue for a while now, and i can't figure out how to solve this. I have a feeling i'm rather close to solving this. But the final piece of the puzzle is missing.
What i'm trying to do? I use the MPDF library to render an PDF based on a XML source file. I want to make use of the nested table functionality. And creating the table with static html and rendering it works like a charm. However, generating the same structure based on the data itself is giving me a headache. The DOM structure should be: https://pastebin.com/zuQAykCB.
With the following code:
echo '<table><tbody>'; foreach($orderConfArray as $orderConfLine ) : $orderConfEconData = isset($orderConfLine['EconData']) ? $orderConfLine['EconData'] : ''; foreach($orderConfEconData as $key => $value) : $x++; if($x === 1 ) : echo ' <tr> <td>blank col</td> <td colspan="6"> <table cellspacing="2" class="inner" width="100%"> <tbody>'; endif; echo '<tr>'; echo '<td>'; echo 'content'; echo '</td>'; echo '</tr>'; if($x === 16 ) : echo ' </tbody> </table> </td> </tr>'; $x = 0; $y = 0; endif; endforeach; endforeach; echo '</tbody></table>';
I get the following output https://pastebin.com/GmVDKw7e, which is close. But not yet what i'm trying to accomplish. I need to do the following (I think) to get this working:
Count the total number of items
If the count reaches a certain number (on the nested table's TD), it should create a new TR within the nested table and continue from there.
If we reach a certain number of TR's within the nested table. It should create a new TR with a nested table altogether.
I can't wrap my head around this. Does anyone have a clue on how to fix this?