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

    do you guys know how to sort the „&pic_query_ids“ that the "output-order" is the same like the "input-order" of the ids?
    I want to have the same pix (and descriptions) in a different order on 2 or more sites.

    Example:

    Page A:
    Input order of the ids in query: [[MaxiGallery &pic_query_ids=`190, 215, 213`..........]]
    Output order: 190, 215, 213

    Page B:
    Input order of the ids in query: [[MaxiGallery &pic_query_ids=`215, 190, 213`..........]]
    Output order: 215, 190, 213

    &order_by=`id` isn’t what i am searching for.
    &order_by=`pos` isn’t possible in my case, because you can only sort in 1 Order. I need 2 different orders.

    I hope you guys understand what i mean.
    Sorry for my bad english.

    great thanks,
    dave
      • 4172
      • 5,888 Posts
      did not try it, but with a little hack like that it should work:

      somewhere about line 2000 in maxigallery.php change this:

      
      <?php//only for styling in this forum
      
      
      $pics = array();
      while ($row = $modx->db->getRow($rs)) {
      	 //array_push($pics, $row);//remove this line
      	 $pics[$row['id']]=$row;//add this line
      }
      
      //add this loop:
      if (count($mg->mgconfig['pic_query_ids']) > 0) {
      	foreach ($mg->mgconfig['pic_query_ids'] as $picid){
             $sortedpics[]= $pics[$picid];         		
      	}
      	$pics=$sortedpics;
      }


      viel Erfolg damit
      Bruno
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 6650
        • 5 Posts
        yeah, that’s it bruno17...
        great thanx
          • 6650
          • 5 Posts
          hi bruno,

          since i modified my maxigallery.php with your code, i have problems with Maxigallery-Calls without the Parameter „&pic_query_ids“.
          Those Gallerys will not be displayed.

          Any Ideas?

            • 4172
            • 5,888 Posts
            and if you remove your modifications all is working?

            can you post a little bit of your code, what you have modified.
            Can’t see a reason, why it shouldn’t work without the Parameter „&pic_query_ids“
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 6650
              • 5 Posts
              yeah, then it’s working.
              when i don’t remove the line „array_push($pics, $row);“ like u said, the gals without „&pic_query_ids“ are displayed.
              but then i have the same problem with the „&pic_query_ids“-galleries - they are don’t displayed.

              Here are a snipped of the modified code from my maxigallery.php:

              <?php//styling
              
              ......................
              //retrieve pics by gal id's (query mode)
              	$rs=$modx->db->select("*", $modx->db->config['table_prefix'].$mg->mgconfig['gtable'], "(gal_id IN ('" . implode("','", $mg->mgconfig['gal_query_ids']) . "') AND NOT hide='1')", $orderby . ' ' . $mg->mgconfig['order_direction'], $mg->mgconfig['offset'].','.$mg->mgconfig['limit']);
              } else if (count($mg->mgconfig['pic_query_ids']) > 0) {
              	//retrieve pics by picture id's (query mode)
              	$rs=$modx->db->select("*", $modx->db->config['table_prefix'].$mg->mgconfig['gtable'], "(id IN ('" . implode("','", $mg->mgconfig['pic_query_ids']) . "') AND NOT hide='1')",$orderby.' '.$mg->mgconfig['order_direction'], $mg->mgconfig['offset'].','.$mg->mgconfig['limit']);
              } else {
              	//retrieve pics normally (by $mg->pageinfo['id'])
              	$rs=$modx->db->select("*", $modx->db->config['table_prefix'].$mg->mgconfig['gtable'], "(gal_id='" . $mg->pageinfo['id'] . "' AND NOT hide='1')",$orderby.' '.$mg->mgconfig['order_direction'], $mg->mgconfig['offset'].','.$mg->mgconfig['limit']);
              }
              
              $pics = array();
              while ($row = $modx->db->getRow($rs)) {
              	 //array_push($pics, $row);//remove this line
              	 $pics[$row['id']]=$row;//add this line
              }
              
              //add this loop:
              if (count($mg->mgconfig['pic_query_ids']) > 0) {
              	foreach ($mg->mgconfig['pic_query_ids'] as $picid){
                     $sortedpics[]= $pics[$picid];         		
              	}
              	$pics=$sortedpics;
              }
              
              $outerTplData['picscount'] = count($pics);
              ..............
              
              


              thanx,
              dave
                • 4172
                • 5,888 Posts
                what happens when you change it like that:

                <?php
                //styling
                
                $pics = array();
                
                if (count($mg->mgconfig['pic_query_ids']) > 0)
                {
                    while ($row = $modx->db->getRow($rs))
                    {
                        $pics[$row['id']] = $row;
                    }
                
                    foreach ($mg->mgconfig['pic_query_ids'] as $picid)
                    {
                        $sortedpics[] = $pics[$picid];
                    }
                    $pics = $sortedpics;
                }
                else
                {
                    while ($row = $modx->db->getRow($rs))
                    {
                        array_push($pics, $row);
                    }
                }
                
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 6650
                  • 5 Posts
                  superbruno,

                  now it seems to be work with and without „&pic_query_ids“.

                  big thanx,
                  dave