coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: Hadar on May 18, 2007, 04:28:12 PM

Title: from categories to images
Post by: Hadar on May 18, 2007, 04:28:12 PM
hey, I want to know how can I change my categories like : Photoshoot to an image ?
Title: Re: from categories to images
Post by: Joachim Müller on May 18, 2007, 06:10:29 PM
hey, I want to know what you're talking about. Use even less words ::). Don't post links ::). Don't read the docs ::).
Title: Re: from categories to images
Post by: Hadar on May 22, 2007, 11:42:11 AM
I want to put a image under the category...
like this : http://www.bepbrazil.com/galeria/
Title: Re: from categories to images
Post by: Joachim Müller on May 22, 2007, 01:08:44 PM
That's a custom piece of code they appear to be using on that page unless they're just using the bbcode ([ i m g ] tag) in the category description field, which should basically do the same you're up to without needing to fiddle with the code.

I can't remember having seen custom code posted anywhere that does exactly what you're up to, so here goes: Edit themes/yourtheme/theme.php, find// HTML template for the category list
$template_cat_list = <<<EOT
and edit the stuff benaeth it as you see fit. If that piece of code doesn't exist in your custom theme, copy// HTML template for the category list
$template_cat_list = <<<EOT
<!-- BEGIN header -->
        <tr>
                <td class="tableh1" width="80%" align="left"><b>{CATEGORY}</b></td>
                <td class="tableh1" width="10%" align="center"><b>{ALBUMS}</b></td>
                <td class="tableh1" width="10%" align="center"><b>{PICTURES}</b></td>
        </tr>
<!-- END header -->
<!-- BEGIN catrow_noalb -->
        <tr>
                <td class="catrow_noalb" colspan="3"><table border="0"><tr><td align="left">{CAT_THUMB}</td><td align="left"><span class="catlink"><b>{CAT_TITLE}</b></span>{CAT_DESC}</td></tr></table></td>
        </tr>
<!-- END catrow_noalb -->
<!-- BEGIN catrow -->
        <tr>
                <td class="catrow" align="left"><table border="0"><tr><td>{CAT_THUMB}</td><td><span class="catlink"><b>{CAT_TITLE}</b></span>{CAT_DESC}</td></tr></table></td>
                <td class="catrow" align="center">{ALB_COUNT}</td>
                <td class="catrow" align="center">{PIC_COUNT}</td>
        </tr>
        <tr>
            <td class="tableb" colspan="3">{CAT_ALBUMS}</td>
        </tr>
<!-- END catrow -->
<!-- BEGIN footer -->
        <tr>
                <td colspan="3" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
        </tr>
<!-- END footer -->
<!-- BEGIN spacer -->
        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
<!-- END spacer -->

EOT;
from themes/sample/theme.php into a new line before?>of themes/yourtheme/theme.php and then edit this stuff. You will have to come up with some custom PHP code that determines what picture to display. Something like// HTML template for the category list
$template_cat_list = <<<EOT
<!-- BEGIN header -->
        <tr>
                <td class="tableh1" width="80%" align="left"><b>{CATEGORY}</b></td>
                <td class="tableh1" width="10%" align="center"><b>{ALBUMS}</b></td>
                <td class="tableh1" width="10%" align="center"><b>{PICTURES}</b></td>
        </tr>
<!-- END header -->
<!-- BEGIN catrow_noalb -->
        <tr>
                <td class="catrow_noalb" colspan="3"><table border="0"><tr><td align="left">{CAT_THUMB}</td><td align="left"><span class="catlink"><b>{CAT_TITLE}</b></span>{CAT_DESC}
EOT;
  //your custom code here that determines what image to display for which category. For demonstration purposes, I have added a simple if/then construct
  if ($cat==1) {
    $template_cat_list .= '<img src="your/first/category/image.jpg" border="0" width="50" height="100" alt="" />';
  } else {
    $template_cat_list .= '<img src="your/second/category/image.jpg" border="0" width="50" height="100" alt="" />';
  }
$template_cat_list .= <<<EOT
                </td></tr></table></td>
        </tr>
<!-- END catrow_noalb -->
<!-- BEGIN catrow -->
        <tr>
                <td class="catrow" align="left"><table border="0"><tr><td>{CAT_THUMB}</td><td><span class="catlink"><b>{CAT_TITLE}</b></span>{CAT_DESC}</td></tr></table></td>
                <td class="catrow" align="center">{ALB_COUNT}</td>
                <td class="catrow" align="center">{PIC_COUNT}</td>
        </tr>
        <tr>
            <td class="tableb" colspan="3">{CAT_ALBUMS}</td>
        </tr>
<!-- END catrow -->
<!-- BEGIN footer -->
        <tr>
                <td colspan="3" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
        </tr>
<!-- END footer -->
<!-- BEGIN spacer -->
        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
<!-- END spacer -->

EOT;
should do the trick.

However, as you appear to be a newbie, I suggest using the bbcode solution.

Joachim

Title: Re: from categories to images
Post by: Hadar on May 22, 2007, 08:04:27 PM
Ok I did it, but it's not finding the pic. I put the image in a folder that called "images" and my code is :     

  if ($cat==1) {
    $template_cat_list .= '<img src="images/7290418.jpg" border="0" width="50" height="100" alt="" />';
  } else {
    $template_cat_list .= '<img src="images/7290419.jpg" border="0" width="50" height="100" alt="" />';
  }

but it's not working.
and thanks for your help  :) really thanks !
Title: Re: from categories to images
Post by: Hadar on May 22, 2007, 09:16:06 PM
Ok, nevermind. it's works but in the 2 categories it is the same pic ??? and i put 2 pics  :-\
Title: Re: from categories to images
Post by: Joachim Müller on May 23, 2007, 07:47:06 AM
The if/then switch was just an example (pseudo code). You'll have to figure this out depending on the categories that you actually have. Posting a link to your gallery might help as well.
Title: Re: from categories to images
Post by: Hadar on May 23, 2007, 12:13:18 PM
This is my gallery: http://mufra.5gbfree.com/
Title: Re: from categories to images
Post by: Joachim Müller on May 23, 2007, 12:47:02 PM
I'm getting
QuoteParse error: syntax error, unexpected '<' in /www/5gbfree.com/m/u/f/mufra/htdocs/themes/water_drop/theme.php on line 61
there. Fix this first.
Title: Re: from categories to images
Post by: Hadar on May 23, 2007, 01:06:28 PM
I fix it
Title: Re: from categories to images
Post by: Joachim Müller on May 23, 2007, 01:13:26 PM
Post the actual code you used - the output on your page shows that you haven't applied the code mentioned above, but something else.
Title: Re: from categories to images
Post by: Hadar on May 23, 2007, 01:16:51 PM
I changed it to this :

  if ($cat==6) {
    $template_cat_list .= '<img src="http://mufra.5gbfree.com/themes/water_drop/images/7290419.jpg" border="0" alt="" />';
  } else {
    $template_cat_list .= '<img src="http://mufra.5gbfree.com/themes/water_drop/images/pic1.jpg" border="0" alt="" />';
  }


6 is the number of the "photoshoots" category...
Title: Re: from categories to images
Post by: Hadar on May 26, 2007, 06:47:37 PM
Help ? ::)