Page 1 of 1

Albums in category displayed in Table view

Posted: Fri Aug 17, 2007 1:31 pm
by bterkuile
In the Album module there is a Tables template you can import. However for the Albums view, all the albums are stored in the same row of the table. Since there is no parameter for the amount of columns in the table, here is a simple way of setting the number of columns. This example makes a table with numCols (2) albums per row.

Code: Select all

<table class="albumlist">
    <tr>
    {assign var="col" value="0"}
{assign var="numCols" value="2"}
    {section name=element loop=$albums}
        {if $col == $numCols}
            </tr><tr>{assign var="col" value="0"}
        {/if}
    
		<td class="thumb">
			<a href="{$albums[element]->link}"><img src="{$albums[element]->thumbnail}" alt="{$albums[element]->name}" /></a>
			<p class="albumname">{$albums[element]->name}<br />
	 	<span class="albumpicturecount">({$albums[element]->picturecount} images)</span><br />
			<span class="albumcomment">{$albums[element]->comment}</span></p>
		</td>
	        {assign var="col" value="`$col+1`"}
    {/section}
    {assign var="remainder" value="`$numCols-$col`"}
    {section name=emptyElement loop=$remainder}
        <td> </td>
    {/section}
    </tr>
</table>