• Resolved cbiagi

    (@cbiagi)


    I’m making custom NGG templates for my NGG gallery. I don’t know PHP very well, so I’m using the tags from Alex’s default templates, and changing it to use my own layout / css.

    I would like to have the ‘description’ from each gallery shown at the top of the gallery’s page. The the layout of each gallery page will basically be:

    Gallery Title
    Gallery Description
    (Thumbnails)

    I tried putting <?php echo $gallery->galdesc ?> into the gallery.php template, but it doesn’t seem to display anything. Putting this same tag into the album.php template DOES display each individual gallery’s description, so it seems that this tag works, but I need to change something to use it in the gallery.php template? And yes, I do actually have a description entered into the NGG admin for the specific gallery I’m testing. ??

    Here is the complete code for my gallery.php template. Note that I have inserted <?php echo $gallery->galdesc ?> into the div “gallery-description”.

    <?php $album = nggdb::find_album( get_query_var('album') ); ?> <!-- this is needed to make the breadcrumb album and gallery names show up -->
    
    <?php
    /**
    Template Page for the gallery overview
    
    Follow variables are useable :
    
    	$gallery     : Contain all about the gallery
    	$images      : Contain all images, path, title
    	$pagination  : Contain the pagination content
    
     You can check the content when you insert the tag <?php var_dump($variable) ?>
     If you would like to show the timestamp of the image ,you can use <?php echo $exif['created_timestamp'] ?>
    **/
    ?>
    <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($gallery)) : ?>
    
    <div class="galleryoverview" id="<?php echo $gallery->anchor ?>">
    
    	<div id="gallery-heading">
    		<h3><?php echo $gallery->title?></h3>
    		<div class="linkout"><a href="#">Return to the Image Gallery</a></div>
    	</div>
    
    	<div id="gallery-description">
    		<?php echo $gallery->galdesc ?>
    	</div>
    
    	<!-- Thumbnails -->
    	<?php foreach ( $images as $image ) : ?>
    
    	<div class="gallery-image" <?php echo $image->style ?> >
    
    		<a>imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >
    			<?php if ( !$image->hidden ) { ?>
    			<img class="gallery-thumb" title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?> />
    			<?php } ?>
    		</a>
    
    	</div>
    
    	<?php if ( $image->hidden ) continue; ?>
    	<?php if ( $gallery->columns > 0 && ++$i % $gallery->columns == 0 ) { ?>
    
    	<?php } ?>
    
     	<?php endforeach; ?>
    
    	<!-- Pagination -->
     	<?php echo $pagination ?>
    
    </div>
    
    <?php endif; ?>

    Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • not sure if you are still looking for the solution. but i just ran across your post and tried some things. The code you want to use is:

    <?php echo $gallery->description ?>

    Thread Starter cbiagi

    (@cbiagi)

    Thanks, I’ll give that a shot.

    Any idea why the tags are different, depending on if it’s used for the Album or Gallery templates? It’s displaying the same description text, either way…

    THX Michael86 it works like a charm ^^
    BTW, I don’t understand why the creator of NGG didn’t think of a shortcode to display the gallery description without having to edit the gallery.php ….?
    Something like [nggallery id=x desc=1]

    Because it will be then a never ending amount of options.

    lol I can imagine the work for you then … though it would be great for us ??
    But first of all, THX for this great photo gallery Alex !

    Thread Starter cbiagi

    (@cbiagi)

    Confirming that Michael86’s tag worked. Thanks!

    (and thank you for the great plugin, Alex!!)

    I’m trying to use the [ slideshow id=x ] shortcode while displaying the description but can’t seem to get it to work.

    Where should this new line in the code be placed within the gallery.php
    <?php echo $gallery->description ?>

    Thread Starter cbiagi

    (@cbiagi)

    I believe you should be able to put that tag anywhere between

    <?php if (!empty ($gallery)) : ?>

    and

    <?php endif; ?>

    Can you be more detailed about the problem with the slideshow shortcode? You might want to start a new thread on it.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: NextGEN Gallery] Custom NGG template: Display a gallery’s description IN the gallery page?’ is closed to new replies.