Page 1 of 1

How to have category name beneath thumbnail?

Posted: 07 May 2009, 23:40
by richpig
Hi

I can't seem to find an answer to this on the forum so hope someone can help!

I'm using the Category List layout for my gallery, with the thumbnail image and the category name next to it. But I want the category name to appear beneath the thumbnail, not to the right of it.

Does anyone know how to re-position it?

It seems the category list page is made up from table cells and I need the category images and category names to be in separate rows rather than columns.

Appreciate it if anyone has any ideas!

Thanks :x

Re: How to have category name beneath thumbnail?

Posted: 08 May 2009, 15:30
by richpig
Managed to work it out :D

In case anyone else should ever want to, this worked for me:

Open the default.php file in the views -> categories -> tmpl folder
The code starts at line 64 with this:

echo '<tr>';
echo '<td align="center" valign="middle" style="'.$this->tmpl['imagebg'].';text-align:center;"><a href="'.$this->categories[$i]->link.'">'.JHTML::_( 'image.site', $this->categories[$i]->linkthumbnailpath, '', '', '', $this->categories[$i]->title, 'style="border:0"' ).'</a></td>';

echo '<td align="center"><a href="'.$this->categories[$i]->link.'" class="category'.$this->params->get( 'pageclass_sfx' ).'">'.$this->categories[$i]->title.'</a>&nbsp;';

if ($this->categories[$i]->numlinks > 0) {echo '<span class="small">('.$this->categories[$i]->numlinks.')</span>';}

echo '</td>';
echo '</tr>';

I added a new echo '<tr>'; in between the first closing </td> and next opening <td>...

echo '<tr>';
echo '<td align="center" width="140px" height="130px" valign="middle" style="'.$this->tmpl['imagebg'].';text-align:center;"><a href="'.$this->categories[$i]->link.'">'.JHTML::_( 'image.site', $this->categories[$i]->linkthumbnailpath, '', '', '', $this->categories[$i]->title, 'style="border:0"' ).'</a></td>';
echo '<tr>';
echo '<td align="center" height="30px"><a href="'.$this->categories[$i]->link.'" class="category'.$this->params->get( 'pageclass_sfx' ).'">'.$this->categories[$i]->title.'</a>&nbsp;';

if ($this->categories[$i]->numlinks > 0) {echo '<span class="small">('.$this->categories[$i]->numlinks.')</span>';}

echo '</td>';
echo '</tr>';
echo '</tr>';

And also a closing echo '</tr>'; and then also some width and height settings to make things layout nicely.

I'm happy punter once more, phoca is a great gallery!

Cheers

Re: How to have category name beneath thumbnail?

Posted: 11 May 2009, 18:12
by Jan
Great. Thank you for sharing your solution.

Jan