samtiria / nextgen-gallery

Automatically exported from code.google.com/p/nextgen-gallery
0 stars 0 forks source link

Feature request: allow use of "template" attr with "nggtags" shortcode to skin the rendered gallery #462

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello, 

I'd greatly appreciate, if the management of [nggtags] shortcode would allow to 
use the "template" attribute to let me skin the resulting list of images, 
something like [nggtags gallery=tag1,tag2 template=sample1], so that I can have 
different renderings of the tag-related gallery.

I specifically need it with gallerytags, not so with albumtags, but I presume 
others might find it useful there as well.

I have tried to add it myself, but have come to a dead end in the 
nggCreateGallery function in nggfunctions.php file.

Thank you very much for your help

Jiri Vasina

Original issue reported on code.google.com by jvas...@gmail.com on 20 Jan 2012 at 9:23

GoogleCodeExporter commented 8 years ago
It seems I have managed to implement it well (at least for the gallery part). I 
have made these modifications:

in file lib/shortcodes.php in function show_tags

   function show_tags( $atts ) {

        extract(shortcode_atts(array(
            'gallery'       => '',
            'album'         => '',
            'template'      => ''
        ), $atts ));

        if ( !empty($album) )
            $out = nggShowAlbumTags($album);
        else
            $out = nggShowGalleryTags($gallery, $template);

        return $out;
    }

and in file nggfunctions.php in function nggShowGalleryTags

function nggShowGalleryTags($taglist, $template) { 

    // $_GET from wp_query
    $pid    = get_query_var('pid');
    $pageid = get_query_var('pageid');

    // get now the related images
    $picturelist = nggTags::find_images_for_tags($taglist , 'ASC');

    // look for ImageBrowser if we have a $_GET('pid')
    if ( $pageid == get_the_ID() || !is_home() )  
        if (!empty( $pid ))  {
            $out = nggCreateImageBrowser( $picturelist );
            return $out;
        }

    // go on if not empty
    if ( empty($picturelist) )
        return;

    // show gallery
    if ( is_array($picturelist) )
        $out = nggCreateGallery($picturelist, false, $template);

    $out = apply_filters('ngg_show_gallery_tags_content', $out, $taglist);
    return $out;
}

could you please incorporate those changes in the NextGEN Gallery source? (I 
have not tried extending it to albumtags, but it would *seem* to be pretty 
straightforward...)

Jiri

Original comment by jvas...@gmail.com on 20 Jan 2012 at 10:16

GoogleCodeExporter commented 8 years ago
Would be great to have this included, so we don't have to mod NGG with every 
update...

Original comment by hb.harle...@gmail.com on 19 Dec 2012 at 6:13