Jeff PHP framework  0.99
Modular, extensible, OOP, MVC, lightweight php framework designed to ease the programmers in the development of web applications.
table.php
Go to the documentation of this file.
00001 <?php
00026 ?>
00027 <table class="<?= $class ?>">
00028 <? if(isset($caption)): ?>
00029 <caption><?= $caption ?></caption>
00030 <? endif ?>
00031         <thead>
00032                 <tr>
00033                 <?php
00034                         if(isset($heads)) foreach($heads as $h) {
00035                                 $class = (is_array($h) && isset($h['class'])) ? " class=\"".$h['class']."\"" : "";
00036                                 $text = (is_array($h) && isset($h['text'])) ? $h['text'] : $h;
00037                                 echo "<th".$class.">$text</th>";
00038                         }
00039                 ?>
00040                 </tr>
00041         </thead>
00042         <tbody>
00043                 <?php
00044                         foreach($rows as $row) {
00045                                 echo "<tr>\n";
00046                                 foreach($row as $cell) {
00047                                         $cell_tag = (is_array($cell) && isset($cell['header']) && $cell['header']) ? "th" : "td";
00048                                         $cell_colspan = (is_array($cell) && isset($cell['colspan']) && $cell['colspan']) ? " colspan=\"".$cell['colspan']."\"" : "";
00049                                         $title = (is_array($cell) && isset($cell['title'])) ? " title=\"".$cell['title']."\"" : '';
00050                                         $text = (is_array($cell) && isset($cell['text'])) ? $cell['text'] : $cell;
00051                                         if(is_array($cell) && isset($cell['class'])) echo "<$cell_tag$cell_colspan$title class=\"".$cell['class']."\">".$text."</$cell_tag>\n";
00052                                         else echo "<$cell_tag>$text</$cell_tag>\n";
00053                                 }
00054                                 echo "</tr>\n";
00055                         }
00056                 ?>
00057         </tbody>
00058         <tfoot>
00059                 <tr>
00060                 <?php
00061                         if(isset($foots) && is_array($foots)) foreach($foots as $f) echo "<td>$f</td>";
00062                         elseif(isset($foots)) echo "<td colspan=\"".count($rows[0])."\">$foots</td>";
00063                 ?>
00064                 </tr>
00065         </tfoot>
00066 </table>