4images Modifications / Modifikationen > Templates & Styles (Requests & Discussions)

Show a thumbnail instead of a folder icon next to category

(1/12) > >>

Chris:
By default, the category_bit.html template displays a folder icon next to categories. It is possible to also display a thumbnail of an image selected at random from that category.

In the category_bit.html template that ships with the downloaded distribution of 4images, there is the following:

--- Code: ---<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top">
      <img src="{template_url}/images/folder.gif" width="20" height="13" alt="" />

      <!-- {if random_cat_image_file}<a href="{cat_url}"><img src="{random_cat_image_file}" border="1"></a>{endif random_cat_image_file}  -->

    </td>
    <td> <a href="{cat_url}" class="maincat">{cat_name}</a>&nbsp;({num_images})
      {if cat_is_new}<sup class="new">{lang_new}</sup>{endif cat_is_new} </td>
  </tr>
</table>
--- End code ---


As you can see above, there is already HTML that can display a random category image thumbnail. It is simply commented out. To activate the thumbnail, uncomment the HTML. In this example the folder icon HTML is deleted in favor of the image thumbnail.

--- Code: ---<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top">

      {if random_cat_image_file}<a href="{cat_url}"><img src="{random_cat_image_file}" border="1"></a>{endif random_cat_image_file}

    </td>
    <td> <a href="{cat_url}" class="maincat">{cat_name}</a>&nbsp;({num_images})
      {if cat_is_new}<sup class="new">{lang_new}</sup>{endif cat_is_new} </td>
  </tr>
</table>
--- End code ---


Lastly, this feature is enabled by default, but if you previously edited includes/constants.php, check to ensure that the following line is present in that file:

--- Code: ---define('SHOW_RANDOM_CAT_IMAGE', 1);
--- End code ---

marchchild:
Thanks Chris  :D

Is it possible to do this with the categories and/or subcats listings on the homepage?

jarano:
HI!

Your mod works but it has a little problem, the thumbnail size it's the same that the categories thumbnail. The idea it's to have a small tumbnail before the name of the sub-category something like 60x40 or less, but a thumbnail of 100x75 it's too much. There is any way to put inside the size of the thumbnail? and force to have the same size in all the thumbnails? Thanks!!

cagedsmurf:
Is it Possible to do this with Mantra's Templates as i cant find the code you show here i am using the 4images dark from his site (http://www.mantradream.com) ?

I posted on his forum he told me to post here because he didn't know

Thanks in advance :lol:

V@no:
yes, u can.

Navigation

[0] Message Index

[#] Next page

Go to full version