forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: wayfarer on November 12, 2004, 08:43:32 am

Title: If title and caption, then display in this cell size, otherwise [option b]
Post by: wayfarer on November 12, 2004, 08:43:32 am
I have modified the intermediate image display so that the title and caption display to the right of the image instead of below. To avoid a long caption taking up too much horizontal space (as it does if I set the title and caption containing cell width to auto), I have made the containing cell 200 pixels wide. If however, there is no title or caption, the image will naturally display slightly offset to the left, instead of dead center, because the 200 pixels width is pushing the image to the left.

Is there a modification I can do so that Coppermine looks to see if there is a title and/or caption and uses the 200 pixels width in the case of the affirmative and if there is no title or caption, then it regards the cell width as auto? So that when there is no title or caption, the image will display in the center of the parent table?

Kind of like an "if this, then that" "but if not, then this instead" scenario...

Here is the relevant code from my theme.php page:

Code: [Select]
// HTML template for intermediate image display
$template_display_picture = <<<EOT
        <tr>
                <td align="center" class="blacktable" height="{CELL_HEIGHT}" style="white-space: nowrap; padding: 0px;">
                        <table cellspacing="2" cellpadding="0" class="imageborder">
                                <tr>
<td align="center" valign="top">
                                                {IMAGE}
                                                {ADMIN_MENU}
                                        </td>
<td align="left" valign="top" width="200">
<p></p>
<!-- BEGIN img_desc -->
<table width="100%" cellpadding="5" cellspacing="0" class="altimagecaption">
<!-- BEGIN title -->
<tr>
<th align="left">
                                                {TITLE}
                                        </th>
</tr>
<!-- END title --><!-- BEGIN caption -->
<tr>
<td align="left">
                                                {CAPTION}
                                        </td>
</tr>
<!-- END caption -->
</table>
<!-- END img_desc --></td>
</tr>
                        </table>                </td>
        </tr>

Title: Re: If title and caption, then display in this cell size, otherwise [option b]
Post by: Joachim Müller on November 12, 2004, 08:50:42 am
don't use fixed (pixel-based) table widths, instead use the css attribute "overflow".

Joachim
Title: Re: If title and caption, then display in this cell size, otherwise [option b]
Post by: wayfarer on November 12, 2004, 09:21:38 am
Ok... I haven't used that attribute before. Just did a bit of research on it. So:

"The overflow declaration tells the browser what to do with content that doesn't fit in a box." And there are several ways the overrun can be handled: visible, scroll, auto and hidden.

But if there is no box size defined, how can content be deemed to have overrun it? And this still wouldn't resolve the image displaying off center when there is no title or caption would it?  ???
Title: Re: If title and caption, then display in this cell size, otherwise [option b]
Post by: wayfarer on November 12, 2004, 10:02:25 am
Hang on, I've got it working  ;D That is a very beautiful thing. Thanks heaps.
Title: Re: captio
Post by: stock on August 21, 2005, 02:56:50 pm
Joachim, I wonder if you can help.

I tried Wayfarer's code and it does exactly what I want, however, if the caption is long, this forces the box to the right, overlapping the menu. How can one restrict it to have the text on as many lines as needed? See http://www.stockshoots.co.uk/displayimage.php?album=70&pos=4 (if you need to log in, sorry, I can do a screen image to show you).

Thanks very much

Stock