表月度排名

时间:2014-04-23 01:04:21

标签: php html dompdf

您对如何在dompdf中实现此表布局有任何建议/提示吗?从数据库中检索数据都很正常我的问题是如何实现我所需的表格布局。

这是我的表输出示例: enter image description here

这是我到目前为止所做的/尝试的:

<table class="ORMExSum2" cellpadding="0" cellspacing="0" border="1" width="100%">
    <thead>
      <tr><th colspan="14">Monthly Rankings</th></tr>
      <tr>
      <th width="10%">Location</th>
      <th width="22.5%">Negative Snippet</th>
        <?php  
            $year = (date('Y')-1);
            $curyear = date('Y');
            $start = new DateTime("Dec 1, $year");
            $end = new DateTime("Dec 31, $curyear");

            $interval = DateInterval::createFromDateString('fourth friday of next month');
            $period = new DatePeriod($start, $interval, $end, DatePeriod::EXCLUDE_START_DATE);

            foreach ($period as $p) { ?>
                <th width="5.63%"><?php echo $p->format("M d"), "\n";?> </th>
         <?php  }
        $mrw1++;
        ?>
      </tr>
     </thead>
     <tbody> 
      <?php $y='a';while($mrw2<$rsummary2): $mrw3 = 0;?>
      <tr>
      <td rowspan="<?php echo $cnt2[$y]+1;$y++;?>">
      <?php echo mysql_result($summary2,$mrw2,"Location");  ?>
      </td>
      <?php for ($i=0; $i < 14; $i++): ?>
      <td></td>
      <?php $cnt++; endfor;?>
      </tr>

        <?php while($mrw3<$rsnippet2): $mrw4 = 0;?>

          <?php if(mysql_result($snippet2,$mrw3,"SummaryID") == mysql_result($summary2,$mrw2,"LocationID")): ?>
            <tr>
            <td style="font-size:11px;">
            <?php echo mysql_result($snippet2,$mrw3,"NegativeSnippet"); ?>
            </td>
          <?php endif;?>
          </tr>
        <?php $mrw3++; endwhile; ?>
        <?php $mrw2++; endwhile; ?>
    </tbody>
  </table>

提前感谢您的帮助。我非常需要它。

0 个答案:

没有答案