fixed myhome picture count by clean implementation of table fill-up

This commit is contained in:
following
2013-03-16 18:15:38 +01:00
parent 047032a78e
commit bf13d22de5
2 changed files with 8 additions and 9 deletions

View File

@@ -166,12 +166,7 @@ function get_logpics($purpose, $userid=0, $cacheid=0, $startat=0)
}
if ($rs !== false)
{
$result = sql_fetch_assoc_table($rs);
while (count($result) % 6)
// fill up table to full line length, so that < 6 pics do not spread over the table width
$result[] = array('pic_uuid' => '');
}
return $result;
}

View File

@@ -14,14 +14,18 @@
{assign var=lines value=$lines+1}
{/if}
{if !$maxlines || $lines < $maxlines}
<td width="{$itemwidth+6}px"> {* width is needed for empty fill-up cells *}
{if $picture.pic_uuid != ""}
{include file="res_logpicture.tpl" picture=$picture}
{/if}
<td>
{include file="res_logpicture.tpl" picture=$picture}
</td>
{assign var=piccount value=$piccount+1}
{/if}
{/foreach}
{* fill up remaining cells so that 2..5 pictures will not spread over container width *}
{if $piccount<6}<td width="{$itemwidth+6}px"></td>{/if}
{if $piccount<5}<td width="{$itemwidth+6}px"></td>{/if}
{if $piccount<4}<td width="{$itemwidth+6}px"></td>{/if}
{if $piccount<3}<td width="{$itemwidth+6}px"></td>{/if}
{if $piccount<2}<td width="{$itemwidth+6}px"></td>{/if}
</tr>
</table>
<div style="height:8px"></div>