Adding Numbering to Album

weyakin

Joined: 2010-11-02
Posts: 4
Posted: Tue, 2010-11-02 15:26

Hi Everyone,

Forgive me, I'm not a PHP guru. I'm typically a designer, not a programmer.

I'm trying to figure out how to number the bottom of each photo in the album section of the gallery. So, under each photo thumbnail, it should read "1", "2", "3" etc... Does anyone know what I can add to dynamically generate the numbers chronologically under each thumbnail?

Thank you so much for your help!

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Tue, 2010-11-02 18:54

You mean like "photo 1 of 10" or what are you looking for?
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
weyakin

Joined: 2010-11-02
Posts: 4
Posted: Tue, 2010-11-02 19:10

Yes, except without the text. Just the single number. So the album will show a row of thumbnail images. Under each image will be a single number. The first image will be titled "1" and the second image "2" and so on. I know on each individual photo it says "Photo 1 of 10" and tried to adapt that into the album display, but with no success.

Let me know if that didn't make sense. Thanks!

 
weyakin

Joined: 2010-11-02
Posts: 4
Posted: Thu, 2010-11-04 17:07

Been fiddling with it some more, but no success. I tried adding pieces with $position, but haven't found a way to make it work yet.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sun, 2010-11-07 05:52

Sure. Edit themes/wind/views/album.html.php and change this:

    10  <? if (count($children)): ?>                                                                                    
    11    <? foreach ($children as $i => $child): ?>                                                                    
    12      <? $item_class = "g-photo"; ?>                                                                              
    13      <? if ($child->is_album()): ?>                                                                              
    14        <? $item_class = "g-album"; ?>                                                                            
    15      <? endif ?>                                                                                                 
    16    <li id="g-item-id-<?= $child->id ?>" class="g-item <?= $item_class ?>">                                       
    17      <?= $theme->thumb_top($child) ?>                                                                            
    18      <a href="<?= $child->url() ?>">                                                                             
    19        <? if ($child->has_thumb()): ?>                                                                           
    20        <?= $child->thumb_img(array("class" => "g-thumbnail")) ?>                                                 
    21        <? endif ?>                                                                                               
    22      </a>                                                                                                        
    23      <?= $theme->thumb_bottom($child) ?>                                                                         
    24      <?= $theme->context_menu($child, "#g-item-id-{$child->id} .g-thumbnail") ?>                                 
    25      <h2><span class="<?= $item_class ?>"></span>                                                                
    26        <a href="<?= $child->url() ?>"><?= html::purify($child->title) ?></a></h2>                                
    27      <ul class="g-metadata">                                                                                     
    28        <?= $theme->thumb_info($child) ?>                                                                         
    29      </ul>                                                                                                       
    30    </li>                                                                                                         
    31    <? endforeach ?>                                                                                              
    32  <? else: ?>                                                                                                     

to:

    10  <? if (count($children)): ?>                                                                                    
    11    <? $i = 0 ?>                                                                                                  
    12    <? foreach ($children as $i => $child): ?>                                                                    
    13      <? $item_class = "g-photo"; ?>                                                                              
    14      <? if ($child->is_album()): ?>                                                                              
    15        <? $item_class = "g-album"; ?>                                                                            
    16      <? endif ?>                                                                                                 
    17    <li id="g-item-id-<?= $child->id ?>" class="g-item <?= $item_class ?>">                                       
    18      <?= $theme->thumb_top($child) ?>                                                                            
    19      <a href="<?= $child->url() ?>">                                                                             
    20        <? if ($child->has_thumb()): ?>                                                                           
    21        <?= $child->thumb_img(array("class" => "g-thumbnail")) ?>                                                 
    22        <? endif ?>                                                                                               
    23      </a>                                                                                                        
    24      <?= $theme->thumb_bottom($child) ?>                                                                         
    25      <?= $theme->context_menu($child, "#g-item-id-{$child->id} .g-thumbnail") ?>                                 
    26      <h2><span class="<?= $item_class ?>"></span>                                                                
    27        <a href="<?= $child->url() ?>"><?= html::purify($child->title) ?></a></h2>                                
    28      <?= ++$i ?>                                                                                                 
    29      <ul class="g-metadata">                                                                                     
    30        <?= $theme->thumb_info($child) ?>                                                                         
    31      </ul>                                                                                                       
    32    </li>                                                                                                         
    33    <? endforeach ?>                                                                                              
    34  <? else: ?>                                                                                                     

Note the new lines at #11 and #28. Note also that you really want to make your own theme and not modify the wind theme else when there's an upgrade your changes will be lost. http://codex.gallery2.org/Gallery3:Themes#Modifying_the_Default_Theme
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git

 
weyakin

Joined: 2010-11-02
Posts: 4
Posted: Sun, 2010-11-07 18:04

Thank you so much! That worked like a charm. I really appreciate it!