We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2912
    • 315 Posts
    I’m not sure where to look for this one but I have a small issue with a website whilst using two maxigallery instances on the same page.

    The main content of the website shows a users maxigallery but on the side bar there is another maxigallery call to pull a random picture from all the gallery images.  The problem occurs when a users goes into the gallery Manager.  Both the users gallery and the random shot picture shows the manager.  Apart from looking awful I think a further issue happens when the user is managing his gallery whilst at the same time the random gallery shot is showing a picture from his gallery.  That instances causes duplicates and data mismatching when the pictures are saved.

    Have I missed something in the documentation to prevent this duplicate managing galleries from happening or is there a way I can stop the random shot gallery from bringing up the manager?

    I think I can write a snippet that looks for the $_POST code and prevent the random shot snippet call but I’m hoping for a built in fix if possible.

    Thanks all,
    BBloke

    EDIT: As a quick fix I made this snippet to check for the Maxigallery Manager. Crude but effective:
    <?php
    
    /********
    // PreventGallery.snippet.php
    // Created by BBloke
    // Date: 3/2/09
    //
    // Run a snippet if manager code is seen
    // 
    // Change the $params as necessary to suit your maxigallery params
    // Remove the MaxiGallery snippet call in the place where you dont want the manager
    // Use your snippet code in its place
    ********/
    
    $runSnippet = "MaxiGallery";
    $params = array();
    	$params['gal_query_ids'] = 'all' ;
    	$params['order_by'] ='random';
    	$params['limit']='1';
    	$params['keep_bigimg']='1';
    	$params['big_img_linkstyle']='external';
    	$params['picture_target']='57';
    	$params['display']='embedded';
    	$params['galleryOuterTpl']='RandomShot';
    	$params['galleryPictureTpl']='galRandomShot';
    	$params['childgalleryTpl']='galRandomShotChild';
    
    if (!$_POST['mode'] == 'admin') {
    	$output .= $modx->runSnippet($runSnippet, $params);
    }
    
    return $output;
    
    /*
    [!MaxiGallery? 
    &gal_query_ids=`all` 
    &order_by=`random` 
    &limit=`1` 
    &keep_bigimg=`1` 
    &big_img_linkstyle=`external` 
    &picture_target=`57` 
    &display=`embedded` 
    &embedtype=`slimbox` 
    &galleryOuterTpl=`RandomShot` 
    &galleryPictureTpl=`galRandomShot` 
    &childgalleryTpl=`galRandomShotChild`!]
    */
    ?>
    


    Change the $params as necessary to suit your maxigallery params
    Remove the MaxiGallery snippet call in the place where you dont want the manager
    Use your snippet code in its place
      BBloke
      • 7923
      • 4,213 Posts
      MaxiGallery is designed so that when ever you have more than one gallery in one document, you need to use the manage_target and is_target parameters to make the picture management on a separate document. Or you could use this http://modxcms.com/forums/index.php/topic,20815.0.html


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 2912
        • 315 Posts
        Thanks for that Doze. I looked at the link and it’s a nice way around things but I’m not one for hacking code incase an update comes up and I forgot what I’ve done.

        I can see what you mean with the manage_target and is_target parameters. I think I’ll spend some time sorting that out later as the quick workaround snippet is handy and save making extra documents.
          BBloke