from categories to images from categories to images
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

from categories to images

Started by Hadar, May 18, 2007, 04:28:12 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hadar

hey, I want to know how can I change my categories like : Photoshoot to an image ?

Joachim Müller

hey, I want to know what you're talking about. Use even less words ::). Don't post links ::). Don't read the docs ::).

Hadar

I want to put a image under the category...
like this : http://www.bepbrazil.com/galeria/

Joachim Müller

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


Hadar

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 !

Hadar

Ok, nevermind. it's works but in the 2 categories it is the same pic ??? and i put 2 pics  :-\

Joachim Müller

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.

Hadar


Joachim Müller

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.

Hadar


Joachim Müller

Post the actual code you used - the output on your page shows that you haven't applied the code mentioned above, but something else.

Hadar

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...

Hadar