matrix -> center incomplete rows
LarryDoliver
Joined: 2003-12-31
Posts: 35 |
Posted: Thu, 2005-08-04 04:42 |
A made a small change to matrix to center the thumbnails on rows that are not full, like these: (see the last row) Here's the patch: @@ -58,14 +58,14 @@ {assign var="childrenInColumnCount" value=0} <div class="gbBlock"> - <table id="gsThumbMatrix" width="100%"> - <tr valign="top"> + <table id="gsThumbMatrix" width="100%" > + <tr valign="top"><td align=center ><table width="100%"><tr> {foreach from=$theme.children item=child} {* Move to a new row *} {if ($childrenInColumnCount == $theme.params.columns)} - </tr> - <tr valign="top"> + </tr></table></td></tr> + <tr valign="top"><td align=center ><table width="100%"><tr> {assign var="childrenInColumnCount" value=0} {/if} @@ -134,9 +134,8 @@ {* flush the rest of the row with empty cells *} {section name="flush" start=$childrenInColumnCount loop=$theme.params.columns} - <td>&</td> {/section} - </tr> + </tr></table></td></tr> </table> </div> {/if} edit 2005-09-24: nivekiam left this just incase I screwed up some of the HTML code conversion @@ -58,14 +58,14 @@ {assign var="childrenInColumnCount" value=0} <div class="gbBlock"> - <table id="gsThumbMatrix" width="100%"> - <tr valign="top"> + <table id="gsThumbMatrix" width="100%" > + <tr valign="top"><td align=center ><table width="100%"><tr> {foreach from=$theme.children item=child} {* Move to a new row *} {if ($childrenInColumnCount == $theme.params.columns)} - </tr> - <tr valign="top"> + </tr></table></td></tr> + <tr valign="top"><td align=center ><table width="100%"><tr> {assign var="childrenInColumnCount" value=0} {/if} @@ -134,9 +134,8 @@ {* flush the rest of the row with empty cells *} {section name="flush" start=$childrenInColumnCount loop=$theme.params.columns} - <td>&</td> {/section} - </tr> + </tr></table></td></tr> </table> </div> {/if} |
|
Posts: 16504
I like that, that's pretty cool. That's for sharing.
I assume it's album.tpl that you're editing for this, correct?
Posts: 32509
LarryDoliver, great work. also presenting panoramas like you do in http://tautologous.com/gallery2/v/panoramas/ looks great.
if it isn't yet in the demos sticky topic, please add it there!
Posts: 35
Thanks - will do...
Posts: 4
Thanks! I have implemented this on my site. One suggestion though. If you do not add valign="top" to the new tr tags you added, the rows of thumbnails can get a bit ragged if some have titles and others do not...
Posts: 23
I tried to fix up the code (get rid of all those stuffed characters):
However, I can't get it working.
In that form it expects the last {/if} to be a {/foreach}. If I do that it expects the foreach further down in albums.tpl to be a {/if} (this is all for matrix btw).
If I comment out the final {/if} in this code, it doesn't give me an error, just borks the gallery view. The first picture occupies the same row as the album title and date row, and the rest appear in a line below the side bar.
A little help would be great.
Posts: 16504
Pippin88, I fixed the code above. The lines that start with a (-) are lines you need to remove, then lines that start with a (+) are lines you need to add. It's a patch so it's telling you what you need to change to make the modification. It should work with the current shipping version of G2 as it appears to work on his site though he's not patched the current version of album.tpl in his <theme>/templates/local directory.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live [url=href="http://photos.kevinnehls.com]here[/url]
Posts: 383
Rather fix it in the css. Never use the valign attribute; it is deprecated!!
______________________
I made a theme for G2, try it
Posts: 23
I applied this change, but didn't like the effect (it stuffed up the alignment on rows with any portrait oriented shots) but now I can't get rid of it?
Changed back to my old album.tpl that doesn't have it, but it's still doing the effect. Deleted the cache for my theme but its still doing it??
Ideas?
Posts: 16504
First be sure you deleted the file from your /theme/<yourtheme>/templates/local directory. Then clear out the template cache in Site Admin > Maintenance
If you're still seeing it then it's a browser cache issue and you should just need to clear your browser cache.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live [url="http://photos.kevinnehls.com]here[/url]
Posts: 23
Clearing the cache through site admin fixed it, cheers.
Posts: 383
The reason that happens is because instead of it being one table a new table is created for every row, I was already thinking to look at this code and perhaps make my own version that only creates a new table for the last rows. But I think that is kind of a lot more complicated to do...
______________________
I made a theme for G2, try it
Posts: 16504
RwD, I'm not 100% sure, but I don't think it would be too hard to do. I'm pretty sure you can find out the number of rows that are suppose to be displayed on a page. Then you should just have to increment a variable until it equals that value then create the table. However, I'm not a programmer, I just play one on TV
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 383
Yes, but then it is a better idea to base yourself on the total nr of items for the current page and do (total div columns) + 1 to find out which row needs a separate table and ((total modulo columns) != 0) to find out if you need one at all. As easy as eating pancakes... Then put code for this part into a template (here's the ouch-ier part of the operation)
;)
______________________
I made a theme for G2, try it