Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // vypocty na tabulku a dopocitavani nakejch blblosti
- $bookOnLine = 4;
- $count = count($this->publikovaneTituly);
- $rows = ceil($count / $bookOnLine);
- $available = $rows * $bookOnLine - $count;
- $data2Table = array();
- $i = 1;
- foreach ($this->publikovaneTituly as $r)
- {
- $data2Table[$i] = $r;
- $i++;
- }
- unset($this->publikovaneTituly); // alokace pameti
- //debug($data2Table);
- echo '<table id="publikovane-tituly"><tr>';
- foreach ($data2Table as $index => $r)
- {
- $date = explode('-', $r->dateexp);
- $newDate = implode('.', array($date[2], $date[1], $date[0]) );
- ?>
- <td class="tac">
- <div><img src="/storage/images/100x/<?= $r->image ?>"></div>
- <strong><?= $r->name ?></strong> (publikováno: <?= $newDate ?>)
- </td>
- <?
- if ($index % $bookOnLine == 0)
- {
- echo "</tr><tr>";
- }
- }
- // dopocitani prazdnych bunek
- if ($available > 0)
- {
- for ($i = 0; $i < $available; $i++)
- {
- ?>
- <td> </td>
- <?
- }
- echo '</tr>';
- }
- echo '</table>';
- ?>
- <script>
- $(window).load(function(){
- var maxHeight = 0;
- $("#publikovane-tituly tr").each(function(index){
- $(this).find("td").each(function(index){
- var imgHeight = $(this).find("img").height();
- if (imgHeight > maxHeight)
- maxHeight = imgHeight;
- });
- });
- if (maxHeight)
- {
- $("#publikovane-tituly").find("img").parent("div").css("height", maxHeight + 10 + "px");
- }
- })
- </script>
Add Comment
Please, Sign In to add comment