On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Quote from: terrybarth at Nov 08, 2016, 10:15 PM
    Progress! I've installed the new package and parsechunk errors are all gone. Thank you!

    I'm still getting these.modsnippet/3 is the getImages snippet
    [2016-11-07 23:26:31] (ERROR @ /home/xxxxxx/public_html/core/model/modx/modx.class.php : 991) `0` is not a valid integer and may not be passed to makeUrl()
    [2016-11-07 23:26:31] (ERROR @ /home/xxxxxx/public_html/core/cache/includes/elements/modsnippet/3.include.cache.php : 96) PHP warning: array_map() expects parameter 1 to be a valid callback, function 'filename' not found or invalid function name
    [2016-11-07 23:26:31] (ERROR @ /home/xxxxxx/public_html/core/cache/includes/elements/modsnippet/3.include.cache.php : 96) PHP warning: array_multisort(): Argument #1 is expected to be an array or a sort flag


    This is my call
    [[!getImages?
     &getImages_Folder=`assets/images/hamline` 
     &getImages_Tpl =`getImages_Image_Tpl`
     &getImages_Sort=`filename`
    ]]


    If this would be easier for you, I can give you manaqger access. Just PM me.
    OK. I see a few things wrong. The getImages_Sort parameter requires a PHP Filesystem Function so filename will not work. You could use basename. You would most likely need to remove the "SORT_DESC," from line 96 or it would sort in reverse order. I should look into fixing the sort so that it works more intuitively. Also getImages_Tpl should read getImages_Image_Tpl otherwise it will be ignored. Since you are using the default name you don't need that line at all.
    • OK, I've have resolved all the getImages errors. Whew!

      So what is basename? Where would I have found this option? While I see all the default options in the snippet comments, I don't see anything that tells me what the other options might be for any of the call parameters. Am I not seeing something I should be?

      And the sort was in reverse order so I commented out line 96. Of course this will be over written with the next update.
      • Quote from: terrybarth at Nov 09, 2016, 03:04 PM
        OK, I've have resolved all the getImages errors. Whew!

        So what is basename? Where would I have found this option? While I see all the default options in the snippet comments, I don't see anything that tells me what the other options might be for any of the call parameters. Am I not seeing something I should be?

        And the sort was in reverse order so I commented out line 96. Of course this will be over written with the next update.
        basename is one of the PHP File Functions just like filemtime and can be found here http://php.net/manual/en/ref.filesystem.php Like I said earlier, I should look into fixing the sort so that it works more intuitively or just rename it so that it more closely matches what it actually does. Instead of sorting it sets a parameter that you can sort on. By default it sets the first parameter of array_map to the last modified time of the file. Using basename would set it to the name of the file. Commenting out line 96 would simply remove the sort from the array altogether and while that might do what you want, it might not. To keep the sort but not have it in reverse order just remove the SORT_DESC from the line or change it to SORT_ASC (the Default behavior)for array_multisort. When I get a chance I think I will dig into that code a bit and try to make a sort parameter with several good sorting options(just added to my To Do list).
        • Basename did the trick for me.

          Might be good to put some notes this affect in the docs.

          Thanks for a great extra!
          • Having troubles getting it to work too! Any help would be greatly appreciated.. I'm sure its something minor in my calls.

            Snippet Call:

            [[!getImages?
            &getImages_Folder=`assets/img/facility`
            &getImages_Tpl=`facilityGalleryTPL`
            &getImages_Ext=`jpg,png,JPG,PNG`
            ]]

            TPL Chunk:

            <div>
            <a href="[[+imgLink]]">
            <img src="[[+imgLink]]" title="[[+image]]" alt="[[+image]]" class="img-responsive">
            </a>
            </div>

            Error Log:

            [2016-11-17 21:29:26] (ERROR @ xxx/www/core/cache/includes/elements/modsnippet/33.include.cache.php : 117) PHP warning: array_reverse() expects parameter 1 to be array, null given
            [2016-11-17 21:29:26] (ERROR @ xxx/www/core/cache/includes/elements/modsnippet/33.include.cache.php : 118) PHP warning: implode(): Argument must be an array

            Tried a bunch of things but I am not really sure what to do next haha.
            • Quote from: dinglestein at Nov 18, 2016, 03:35 AM
              Having troubles getting it to work too! Any help would be greatly appreciated.. I'm sure its something minor in my calls.

              Snippet Call:

              [[!getImages?
              &getImages_Folder=`assets/img/facility`
              &getImages_Tpl=`facilityGalleryTPL`
              &getImages_Ext=`jpg,png,JPG,PNG`
              ]]

              TPL Chunk:

              <div>
              <a href="[[+imgLink]]">
              <img src="[[+imgLink]]" title="[[+image]]" alt="[[+image]]" class="img-responsive">
              </a>
              </div>

              Error Log:

              [2016-11-17 21:29:26] (ERROR @ xxx/www/core/cache/includes/elements/modsnippet/33.include.cache.php : 117) PHP warning: array_reverse() expects parameter 1 to be array, null given
              [2016-11-17 21:29:26] (ERROR @ xxx/www/core/cache/includes/elements/modsnippet/33.include.cache.php : 118) PHP warning: implode(): Argument must be an array

              Tried a bunch of things but I am not really sure what to do next haha.
              What does your getImages_Page_Tpl look like?
              • Quote from: dinglestein at Nov 18, 2016, 03:35 AM

                [[!getImages?
                &getImages_Folder=`assets/img/facility`
                &getImages_Tpl=`facilityGalleryTPL`
                Should be &getImages_Image_Tpl=`facilityGalleryTPL`
                • Oops, okay I am still getting these errors though.

                  [2016-11-23 16:31:24] (ERROR @ /xxx/www/core/cache/includes/elements/modsnippet/33.include.cache.php : 117) PHP warning: array_reverse() expects parameter 1 to be array, null given
                  [2016-11-23 16:31:24] (ERROR @ /xxx/www/core/cache/includes/elements/modsnippet/33.include.cache.php : 118) PHP warning: implode(): Argument must be an array


                  [[!getImages?
                  &getImages_Folder=`assets/img/facility`
                  &getImages_Image_Tpl=`facilityGalleryTPL`
                  &getImages_Ext=`*.jpg,*.gif,*.png,*.JPG,*.GIF,*.PNG`
                  ]]

                  <div>
                  <a href="[[+imgLink]]">
                  <img src="[[+imgLink]]" title="[[+image]]" alt="[[+image]]" class="img-responsive">
                  </a>
                  </div>
                  • Quote from: dinglestein at Nov 23, 2016, 10:34 PM
                    Oops, okay I am still getting these errors though.

                    [2016-11-23 16:31:24] (ERROR @ /xxx/www/core/cache/includes/elements/modsnippet/33.include.cache.php : 117) PHP warning: array_reverse() expects parameter 1 to be array, null given
                    [2016-11-23 16:31:24] (ERROR @ /xxx/www/core/cache/includes/elements/modsnippet/33.include.cache.php : 118) PHP warning: implode(): Argument must be an array


                    [[!getImages?
                    &getImages_Folder=`assets/img/facility`
                    &getImages_Image_Tpl=`facilityGalleryTPL`
                    &getImages_Ext=`*.jpg,*.gif,*.png,*.JPG,*.GIF,*.PNG`
                    ]]

                    <div>
                    <a href="[[+imgLink]]">
                    <img src="[[+imgLink]]" title="[[+image]]" alt="[[+image]]" class="img-responsive">
                    </a>
                    </div>
                    &getImages_Ext=`*.jpg,*.gif,*.png,*.JPG,*.GIF,*.PNG`
                    should be
                    &getImages_Ext=`jpg,gif,png,JPG,GIF,PNG`
                    also there is no parrameter named image so [[+image]] will do nothing. I would guess your looking for [[+imgName]]. That will give you the name of the file without extension. You may want to use the
                    diag_getImages_Image_Tpl so that you can see what is being passed.
                    • Sorry I forgot to post back here reporting what was wrong for me haha.

                      So my call was missing the page TPL and I suppose not generating my image TPL without it being called.

                      [[!getImages?
                      &getImages_Folder=`assets/images/facility`
                      &getImages_Image_Tpl=`facilityGalleryTPL`
                      &getImages_Page_Tpl=`example_getImages_Page_Tpl`
                      ]]

                      Thanks,

                      JD