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
Posts: 383
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
Posts: 13
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
Posts: 383
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
Posts: 13
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.
Posts: 383
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
that needs to change into:
But only if you want to use that table markup.
__________
Ey?
______________________
I made a theme for G2, try it
Posts: 13
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.
Posts: 383
He did this in the css:
and probably something like this in the album.tpl:
Ow, thanks :P I was confused between the terms skin and theme.
______________________
I made a theme for G2, try it
Posts: 13
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
Posts: 383
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
Posts: 13
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.