Albums in category displayed in Table view

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
bterkuile
Forum Members
Forum Members
Posts: 97
Joined: Sun Jul 22, 2007 11:48 am
Location: Netherlands

Albums in category displayed in Table view

Post 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>
Post Reply

Return to “Modules/Add-Ons”