• Resolved gp4thdukeofyork

    (@phorbidden)


    So I have implemented the random images onto my sidebar on m own (I didn’t want to use the widget because I wanted it to just do one thing all the time and not give my client the capability to modify it.

    So in my own sidebar.php I used the following code:
    <?php if (function_exists(“nggShowRandomRecent”)) {echo nggShowRandomRecent(‘random’,6,’home’);} ?>

    This works well and I utilize my own theme that looks like this:

    <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($gallery)) : ?>
    <ul>
      <?php //echo "images is ".print_r($images); ?>
    	<?php foreach ( $images as $image ) : ?>
    	<li><a href="<?php echo $image->pagelink; ?>" title="<?php echo $image->alttext ?>" ><?php if ( !$image->hidden ) { ?><img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" width="74" height="74" /><?php } ?></a></li>
    	<?php if ( $image->hidden ) continue; endforeach; ?>
    </ul>
    <?php endif; ?>

    the <?php echo $image->pagelink; ?> works if you mod nggfunctions.php with this:
    $picturelist[$key]->pagelink = get_permalink( $picture->pageid );
    around line 358
    and that allows me to show a link for the page associated to the gallery the images are associated with.

    My only issue I have now is that if I go to a page that displays a gallery’s images and I click to page 2 of the pagination then the nggShowRandomRecent will go to my theme and only print

    I have print_r the $picturelist array that goes into nggCreateGallery and it looks fine,b ut it won’t come out the other end of that function… the only thing I see different is that the url at top has ?nggpage=2 in it. And no matter is I unset($nggpage) before entering nggShowRandomRecent it breaks…

    Any help would be great… if not then I understand *kicks a can down the block*

    Oh and I commented out:

    if ( $pageid == get_the_ID() || !is_home() )
            if (!empty( $pid ))  {
                foreach ($picturelist as $picture) {
                    $picarray[] = $picture->pid;
                }
                $out = nggCreateImageBrowser($picarray);
                return $out;
            }

    in nggShowRandomRecent because sometimes it would invoke it in nggpage=3 or so. Very weird issue and if I dig for another 3 days I might find it 😉

Viewing 15 replies - 1 through 15 (of 18 total)
  • Thread Starter gp4thdukeofyork

    (@phorbidden)

    bump

    can you give me a link as demo ?

    Thread Starter gp4thdukeofyork

    (@phorbidden)

    sure Alex… I need to take it out of maintenance mode… let me know when you are able to review

    Thread Starter gp4thdukeofyork

    (@phorbidden)

    go ahead and view it here:
    http://www.sounds-like.org/blog

    Thread Starter gp4thdukeofyork

    (@phorbidden)

    bump

    So in the case you add : ?nggpage=2 , the function nggCreateGallery() return two times a content in $out (main gallery & random widget) ?

    Thread Starter gp4thdukeofyork

    (@phorbidden)

    when you go to http://sounds-like.org/blog/gallery-m-a-n-d-y-album-tour/?nggpage=2 the call to <?php if (function_exists(“nggShowRandomRecent”)) {echo nggShowRandomRecent(‘random’,6,’home’);} ?> only provides the following in the GALLERY section of the sidebar:

    <ul>
    </ul>

    from my template page that looks like this:

    <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($gallery)) : ?>
    <ul>
      <?php //echo "images is ".print_r($images); ?>
    	<?php foreach ( $images as $image ) : ?>
    	<li><a href="<?php echo $image->pagelink; ?>" title="<?php echo $image->alttext ?>" ><?php if ( !$image->hidden ) { ?><img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" width="74" height="74" /><?php } ?></a></li>
    	<?php if ( $image->hidden ) continue; endforeach; ?>
    </ul>
    <?php endif; ?>

    I guess I am not sure what you are asking…

    Go to nggfunctions.php and look into nggCreateGallery(); check the $out before it returns with var_dump()

    Thread Starter gp4thdukeofyork

    (@phorbidden)

    ahhh ok…

    Thread Starter gp4thdukeofyork

    (@phorbidden)

    tried to print_r it before ‘$out = apply_filters(‘ngg_gallery_output’, $out, $picturelist);’ after ‘$out = nggGallery::capture ( $filename, array (‘gallery’ => $gallery, ‘images’ => $picturelist, ‘pagination’ => $navigation, ‘current’ => $current_pid, ‘next’ => $next, ‘prev’ => $prev) );’

    I get nothing.

    Thread Starter gp4thdukeofyork

    (@phorbidden)

    I might not have performed that well… 😉

    Then check before $out = nggGallery::capture …
    if you have a picture array or not : var_dump($picturelist), if this empty check the array before the pagination cut the array (line 288)

    Thread Starter gp4thdukeofyork

    (@phorbidden)

    ok

    using var_dump (instead of print_r) before:
    $out = apply_filters(‘ngg_gallery_output’, $out, $picturelist);

    results in:
    string(14) ” “

    before:
    $out = nggGallery::capture ( $filename, array (‘gallery’ => $gallery, ‘images’ => $picturelist, ‘pagination’ => $navigation, ‘current’ => $current_pid, ‘next’ => $next, ‘prev’ => $prev) );

    results:
    NULL

    before pagination var_dump($picturelist); gives us the (what seems to be) the proper array.

    Sorry my mistake, check before $out = nggGallery::capture… var_dump($picturelist); this should contain the array

    Thread Starter gp4thdukeofyork

    (@phorbidden)

    oh ha…

    array(0) { }

    that is what it gives me

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Plugin: NextGEN Gallery] Random Images on paginated pages’ is closed to new replies.