Adding titles to thumbnails with Siriux theme?

Veazer

Joined: 2005-09-27
Posts: 13
Posted: Tue, 2005-09-27 06:23

I'm attempting to add a small change to the Siriux theme (cloned and renamed SiriuxMod) but I can't seem to get it to work right. If this has been addressed or if I overlooked the obvious I apologize, just point me in the right direction. I did a search for Siriux mods and checked all 3 pages of results.

I want to add the title of images centered and directly below them. I thought (as a newbie hack) I could change album.tpl as follows (blue is my addition):

  <div class="gallery-items">
    {foreach from=$theme.children item=child}
      {if !$child.canContainChildren}
	<div class="gallery-thumb">
	  <a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}">
	  {if isset($child.thumbnail)}
	    {g->image item=$child image=$child.thumbnail}
	  {else}
	    {g->text text="no thumbnail"}
	  {/if}
	  </a>
	  <br>
	  {$child.title|markup}
	</div>
      {/if}
    {/foreach}
    <div class="clear"></div>
  </div>

This crude hack worked ok for Firefox and Opera but breaks the theme for IE. I'm new to Gallery & not very good with CSS yet so I'm probably approaching this incorrectly. IIRC force linebreaks should not be used. Any pointers would be appreciated.

Also, can anyone recommend a good starting point for learning about CSS?

Thanks,
Dave

 
RwD
RwD's picture

Joined: 2005-01-09
Posts: 383
Posted: Tue, 2005-09-27 06:56

There are actually more ways to solve this, but I am going to show you the way it is done in the matrix theme as well:

  <div class="gallery-items">
    {foreach from=$theme.children item=child}
      {if !$child.canContainChildren}
	<div class="gallery-thumb">
	  <a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}">
	  {if isset($child.thumbnail)}
	    {g->image item=$child image=$child.thumbnail}
	  {else}
	    {g->text text="no thumbnail"}
	  {/if}
	  </a>
	  <p class="giTitle">{$child.title|markup}</p>
	</div>
      {/if}
    {/foreach}
    <div class="clear"></div>
  </div>

After this change it already displays in the center at my installation, if it doesn't at yours you might want to try to use css to edit properties for the class ".gallery-thumb .giTitle"

Css tutorial
Css reference
More links

By the way, you can copy files into a subdirectory called "local" from there original position and edit those versions. The local versions will be used but not overwritten by upgrades so you do not have to clone a theme and call it themeMod. Of course with bigger changes it might be a good idea to clone anyway...
______________________
I made a theme for G2, try it :)

 
Veazer

Joined: 2005-09-27
Posts: 13
Posted: Tue, 2005-09-27 07:48

Thanks for the suggestion. It doesn't seem to work for me, although it might if I were using square thumbs. Using your method the titles get covered by the taller pics. Also, the title is a bit farther from the thumbnail than I wanted. That's actually the reason I used a <br> to keep the elements closer together. I wish my coding skills were better...

Check out the 'Art' section and you'll see what I mean: 4seven4.com

 
RwD
RwD's picture

Joined: 2005-01-09
Posts: 383
Posted: Tue, 2005-09-27 08:11

I see your problem, but now it is FF only. I never understand why it is ok to put elements on top of eachother even though their z-index is the same (even though I know how the css box model and stuff works). I am at my work right now, so now real extensive testing but could you try adding: ".gallery-thumb { clear: both; }" to your css??

Never use the <br/> element unless it has semantical value, but never "just" to get a text on the next line.
______________________
I made a theme for G2, try it :)

 
Veazer

Joined: 2005-09-27
Posts: 13
Posted: Tue, 2005-09-27 09:39

RwD-
I only checked FF, but after some browser checking I also noticed big problems with IE. See how the images on the second, fourth & sixth line shift to the right? It's the same problem that my hack introduced.

I added your fix to the CSS file but it forced all the thumbnails into a single column on the left. I removed it after that.

.gallery-thumb {
	margin: 3px;
	float: left;
	text-align: center;
	clear: both;
}

I created a new style for the titles with margins 0px to get the title closer to the thumbnail. How can I increase vertical spacing between thumbnail rows? All the spacing options I see in CSS are margins affecting horizontal spacing as well. I think that more vertical space could be a workaround for the overlap portion of the problem, although the image shifting in IE still occurs.

Nice skin btw, i like it.

 
RwD
RwD's picture

Joined: 2005-01-09
Posts: 383
Posted: Tue, 2005-09-27 09:47

Actually, without checking, I think that the siriux theme doesn't use a table to display the items. If you study the matrix code where it displays albums and subitems (also album.tpl) and merge tha tables part of the code back into the siriux template then it will always display the intended way. You might have to tinker with the .inc file because I seem to recall the siriux theme not defining nr of columns and nr of rows where Marix did do that.

It is

	$this->setStandardSettings(
	    array('showImageOwner' => 0,
		  'perPage' => 9,

that needs to change into:

	$this->setStandardSettings(
	    array('rows' => 3, 'columns' => 3,
		  'showImageOwner' => 0,

But only if you want to use that table markup.
 
 
__________

Veazer wrote:
Nice skin btw, i like it.

Ey?

______________________
I made a theme for G2, try it :)

 
Veazer

Joined: 2005-09-27
Posts: 13
Posted: Tue, 2005-09-27 09:58

I'd like to avoid tables but I will explore that option. I think I need talk with rogermh and see how he did it on his site, he's done a lovely job with the theme without using tables.

http://rohjuh.com/gallery/main.php

edit: BTW, my skin complement was referring to the skin in you sig.

 
RwD
RwD's picture

Joined: 2005-01-09
Posts: 383
Posted: Tue, 2005-09-27 10:11

He did this in the css:

.gallery-item {
/* Thumbs are 150X150, 162X162 incl padding & border, total width=820 --> (820-162*4)/5 = 34.4 height for gallery-album is less because captions are generally shorter than for gallery-item */
    width: 162px;
    height: 280px;
    margin: 20px 0 0 35px;
    padding: 0;
    display: inline; /* fixes IE float bug */
    float: left;
    overflow: hidden;
}

and probably something like this in the album.tpl:

  <div class="gallery-items">
    {foreach from=$theme.children item=child}
      {if !$child.canContainChildren}
      	<div class="gallery-item">
	  <div class="gallery-thumb">
	    <a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}">
	    {if isset($child.thumbnail)}
	      {g->image item=$child image=$child.thumbnail}
	    {else}
	      {g->text text="no thumbnail"}
	    {/if}
	    </a>
	  </div>
	  <p class="giTitle">{$child.title|markup}</p>
	</div>
      {/if}
    {/foreach}
    <div class="clear"></div>
  </div>

Ow, thanks :P I was confused between the terms skin and theme.
______________________
I made a theme for G2, try it :)

 
Veazer

Joined: 2005-09-27
Posts: 13
Posted: Tue, 2005-09-27 20:18

That seemed to mess things up further, all the titles ended up far to the right of the thumbs. The inline fix for IE didn't work either, not sure why. I'm going to restart with a fresh copy of Siriux just in case I messed up something up. I'll keep a log of all changes this time.

Dave

 
RwD
RwD's picture

Joined: 2005-01-09
Posts: 383
Posted: Tue, 2005-09-27 21:55

See, the thing is that he only put in some extra control by adding the extra div and then he gave them a fixed height and floated them to the left. I don't think you actually have to float them, but you should keep the display:inline part because divs usually display as blocks and will not line up next to eachother. so perhaps you should ive it a try without the float:left....
______________________
I made a theme for G2, try it :)

 
Veazer

Joined: 2005-09-27
Posts: 13
Posted: Sat, 2005-10-01 00:06

Thanks for all your help with this. I think I'm getting it now. I appreciate your help. The only problem I am having now is some inline css that is overwriting values in my theme.css file. Where is the inline css generated? i can't find the cuplrit. There seems to be some automatic 'padding' of the thumbnails that I would prefer to control myself.

For anyone else learning CSS or just wanting a faster way to see reults, the web developer plugin for firefox was incredibly helpful for fine tuning and troubleshooting my problem. What a fantastic plugin.