We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30879
    • 40 Posts
    Hi Guys,

    hoping someone can help out with 2 issues im currently facing.

    1.

    I have this code on my homepage.
    [!MaxiGallery? &display=`childgalleries` &childgalleries_ids=`38` &limit=`1` &order_by=`random` &childgalleries_level_limit=`3` &manageButtonTpl=`CODE:`!]


    38 is the container that my galleries are under.

    the problem is its not limiting to 1 even though the limit is in there im going crazy!


    Also problem 2. which relates to this.

    2.

    the above random code is shown on every page its basically a box under the menu. when im viewing one of the gallery pages the manage button isnt visable for the random box which is good! but then if i click manage for the gallery that im viewing all of the management controls appear for both the random box and the gallery. this of course throws out my whole site alignment.

    is there a way of disabling all the management options on a specific call?

    FIXED THAT WITH &manageOuterTpl=`CODE:`
      • 7923
      • 4,213 Posts
      Try &childgalleries_limit. See MaxiGallery wiki page for available parameters!


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 30879
        • 40 Posts
        thanks mate, solved this in the early hours of the morning.

        not sure why i couldnt see it in the wiki (i chekced it about 200 times lol)

        fixed with
        [!MaxiGallery? &childgalleries_ids=`38` &display=`childgalleries` &childgalleries_limit=`1` &manageButtonTpl=`CODE:` &manageOuterTpl=`CODE:` &galleryOuterTpl=`outerrandomportfolio` &childgalleryTpl=`gallerylisting`!]


        working well now. do you know how i can radmonise which "1" it shows?

        Also a tip for anyone - i found i was sometimes getting weird behaviour when viewing a gallery (when the page also had the above code in it)

        i found that by adding the templates i controlled exactly what was outputted - and good bye weird behaviour!!!

        few more tweaks and ill put up a sample of what ive done smiley
          • 30879
          • 40 Posts
          hey. im hoping someone can help , while the above did fix that problem, its left m with another ive been trying to work out.

          I want to to show 1 random gallery, and a link to that gallery. Im finding it is at the moment only ever showing the one gallery. it never shows the ther gallery. code below - help would be appreciated laugh


          for my random code i have this.

          [!MaxiGallery? &childgalleries_ids=`38` &display=`childgalleries`  &order_by=`random` &childgalleries_limit=`1` &manageButtonTpl=`CODE:` &manageOuterTpl=`CODE:` &galleryOuterTpl=`outerrandomportfolio` &childgalleryTpl=`gallerylisting`!]


          38 is my container - that has atleast 2 pages under them with galleries on them.

          for my outerrandomportfolio chunk i have just

          [+maxigallery.childgalleries+]



          my childgalleryTpl is
          <a href="[+maxigallery.childurl+]"><img src="[*myimage:phpthumb=`h=130&w=130&zc=1#[+maxigallery.path_to_gal+][+maxigallery.picture.filename+]#1`*]" class="brdrdashed" title="[+maxigallery.strings.go_to_gallery+]" alt="[+maxigallery.strings.go_to_gallery+]" /></a><br /><b>Client:</b> [+maxigallery.pageinfo.pagetitle:htmlent+]
          
            • 7923
            • 4,213 Posts
            Hmm.. Are you sure that you are reading the correct wiki page? rolleyes

            Try: &childgalleries_order_by=`random`


              "He can have a lollipop any time he wants to. That's what it means to be a programmer."
              • 30879
              • 40 Posts
              Quote from: doze at Jul 16, 2009, 08:27 AM

              Hmm.. Are you sure that you are reading the correct wiki page? rolleyes

              Try: &childgalleries_order_by=`random`

              hi sorry the wiki doesnt state that random is an accepted option.

              I tried random and get this error now.

              « MODx Parse Error »
              MODx encountered the following error while attempting to parse the requested resource:
              « Execution of a query to the database failed - FUNCTION sc.RAND does not exist »
              SQL: SELECT DISTINCT sc.* FROM `optic_cms`.`modx_site_content` sc LEFT JOIN `optic_cms`.`modx_document_groups` dg on dg.document = sc.id WHERE (sc.id IN (39,51) AND sc.published=1 AND sc.deleted=0 ) AND (sc.privateweb=0) GROUP BY sc.id ORDER BY sc.RAND() ASC

              completed call is
              [!MaxiGallery? &childgalleries_ids=`38` &display=`childgalleries` &childgalleries_limit=`1` &childgalleries_order_by=`random` &manageButtonTpl=`CODE:` &manageOuterTpl=`CODE:` &galleryOuterTpl=`outerrandomportfolio` &childgalleryTpl=`gallerylisting`!]
                • 7923
                • 4,213 Posts
                Yeah.. it seems that the MODx getDocuments() api call has been refactored to use table references and it replaces all sorting parameters with "sc." reference prefix in them. That unfortunately means that it will break the use of mysql functions (I’ll file a Jira bug about it).

                Anyhow.. try if this works:

                1. open up maxigallery.class.inc.php
                2. change lines 870 to 878

                from this:
                		//if random order, use mysql RAND() 
                		if ($sortby == "random") {
                			$order = "RAND()";
                		}else{
                			$order = $sortby;
                		}
                		
                		$resources = $modx->getDocuments($kids, $showPublishedOnly, 0, "*", '', $order, $sortdir);
                		
                


                to this:
                		//if random order, use menuindex for the sql query
                		if ($sortby == "random") {
                			$order = "menuindex";
                		}else{
                			$order = $sortby;
                		}
                		
                		$resources = $modx->getDocuments($kids, $showPublishedOnly, 0, "*", '', $order, $sortdir);
                
                		//if random order, shuffle the resources array
                		if ($sortby == "random") {
                			shuffle($resources);
                		}
                


                Let me know how it goes...


                  "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                  • 30879
                  • 40 Posts
                  now i get

                  PHP error debug
                  Error: array_slice() expects parameter 1 to be array, boolean given
                  Error type/ Nr.: Warning - 2
                  File: /home/bing/public_html/new/assets/snippets/maxigallery/maxigallery.class.inc.php
                  Line: 1755
                  Line 1755 source: $resources = array_slice($resources, 0, $limit);

                  my php is spaced so the line its refering to is the one after the one u got me to change.

                  
                  if ($limit != 0) {
                  
                  			$resources = array_slice($resources, 0, $limit);
                  
                  		}
                  
                  		
                  
                    • 7923
                    • 4,213 Posts
                    Sorry, replace:
                    $resources = shuffle($resources);
                    

                    with:
                    shuffle($resources);
                    


                    The shuffle function return boolean value and not the modified version of the array. I updated the above post.


                      "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                      • 30879
                      • 40 Posts
                      that works perfect mate!!