WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
List Images under each Gallery in Album (3 posts)

  1. eperinelli
    Member
    Posted 3 years ago #

    hi everybody,

    i'm trying to obtain a list of galleries inside an album, and under each gallery, to list the contained images

    i've created a new album template, the hot part loks like this:

    <!-- List of galleries -->
    	<?php foreach ($galleries as $gallery) : ?>
    
    	<div class="ngg-album">
    		<div class="ngg-albumtitle">
    			<?php echo $gallery->title ?>
    		</div>
    		<div class="image-list">
    			HERE I WANT TO GET A LIST OF THE IMAGES IN CURRENT GALLERY
    		</div>
    	</div>
    
     	<?php endforeach; ?>

    since i'm not a real PHP programmer, i don't know how to use the plugin functions to obtain what i need, i would like to obtain something like the "$images" array i can use inside the GALLERY templates

    help me please!

    e.perinelli

    http://wordpress.org/extend/plugins/nextgen-gallery/

  2. eperinelli
    Member
    Posted 3 years ago #

    No idea anybody?

    Where can I find documentation on how the plugin works internally?

  3. eperinelli
    Member
    Posted 3 years ago #

    looks like i'm learning PHP the hard way...

    i've used a dirty solution, modifying the GALLERY CAROUSEL TEMPLATE and fetching the titles of the gallery and the list of the images "by hand"

    i don't understand how the variable "$current" is valorized, looks like i can list the pictures in multiple galleries but not display all of them throught the "$current" value...

    i'm a bit ashamed of my code, but just in case...

    <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($gallery)) : ?>
    
    			<?php var_dump($current) ?>$current
    
    <!-- PRIMA COLLEZIONE !! -->
    
    	<div class="collection-list list-1">	
    
    		<?php /** TITOLO **/  ?>
    		<strong><?php /** RACCOLGO LA GALLERIA **/ $galleryFirst = nggdb::find_gallery( 2 ) ;
    				echo($galleryFirst->title); ?>
    		</strong>
    
    			<?php /** RACCOLGO LE IMMAGINI **/
    			$imagesFirst = nggdb::get_gallery( 2 ); ?>
    
    			<?php /** SCORRO LE IMMAGINI **/
    			foreach ( $imagesFirst as $image ) :  ?>
    
    			<ul>
    
    				<li id="ngg-image-<?php echo $image->pid ?>" class="ngg-thumbnail-list <?php if ($image->pid == $current->pid) echo 'selected' ?>" >
    					<?php if ( $image->hidden ) continue; ?>
    					<a href="?pid=<?php echo $image->pid ?>" title="<?php echo $image->alttext ?>" >
    							<?php echo $image->alttext ?>
    					</a>
    				</li>
    
    			</ul>
    
    			<?php endforeach; ?>
    
    	</div>
    
    <!-- SECONDA COLLEZIONE !! -->
    
    	<div class="collection-list list-2">	
    
    		<?php /** TITOLO **/  ?>
    		<strong><?php /** RACCOLGO LA GALLERIA **/ $galleryFirst = nggdb::find_gallery( 3 ) ;
    				echo($galleryFirst->title); ?>
    		</strong>
    
    			<?php /** RACCOLGO LE IMMAGINI **/
    			$imagesFirst = nggdb::get_gallery( 3 ); ?>
    
    			<?php /** SCORRO LE IMMAGINI **/
    			foreach ( $imagesFirst as $image ) :  ?>
    
    			<ul>
    
    				<li id="ngg-image-<?php echo $image->pid ?>" class="ngg-thumbnail-list <?php if ($image->pid == $current->pid) echo 'selected' ?>" >
    					<?php if ( $image->hidden ) continue; ?>
    					<a href="?pid=<?php echo $image->pid ?>" title="<?php echo $image->alttext ?>" >
    							<?php echo $image->alttext ?>
    					</a>
    				</li>
    
    			</ul>
    
    			<?php endforeach; ?>
    
    	</div>
    
    <!-- TERZA COLLEZIONE !! -->
    
    	<div class="collection-list list-3">	
    
    		<?php /** TITOLO **/  ?>
    		<strong><?php /** RACCOLGO LA GALLERIA **/ $galleryFirst = nggdb::find_gallery( 4 ) ;
    				echo($galleryFirst->title); ?>
    		</strong>
    
    			<?php /** RACCOLGO LE IMMAGINI **/
    			$imagesFirst = nggdb::get_gallery( 4 ); ?>
    
    			<?php /** SCORRO LE IMMAGINI **/
    			foreach ( $imagesFirst as $image ) :  ?>
    
    			<ul>
    
    				<li id="ngg-image-<?php echo $image->pid ?>" class="ngg-thumbnail-list <?php if ($image->pid == $current->pid) echo 'selected' ?>" >
    					<?php if ( $image->hidden ) continue; ?>
    					<a href="?pid=<?php echo $image->pid ?>" title="<?php echo $image->alttext ?>" >
    							<?php echo $image->alttext ?>
    					</a>
    				</li>
    
    			</ul>
    
    			<?php endforeach; ?>
    
    	</div>
    
    	<div class="bottom-collection">
    		<div class="collection-element">
    			<div class="pic"><img title="<?php echo $current->alttext ?>" alt="<?php echo $current->alttext ?>" src="<?php echo $current->url; ?>" height="250" width="790" /></div>
    		</div>
    	</div>
    
    </div>
    
    <?php endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.