We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I am trying to use FileLister to list image files in a directory to create a lightbox. I have it working except I need to add a class to the first li, and I need to modify the phpthumbof dimension for the first thumbnail.

    Everything I have tried to do to alter that first row has failed. Can't get the first class property to work although it exists in the snippet.

    To modify the phpthumbof on the first thumbnail I tried
    +idx:is=`1`:then= etc.
    but no luck with that. Wondering about the IF snippet but still unsure how to grab that first row.

    This is my snippet call:

    [[!FileLister? 
    &path=`../ew/[[*reportFolder]]/` 
    &fileTpl=`HMtplFile` 
    &showDirectories=`0` 
    &showExt=`jpg,png,gif` 
    &placeholderPrefix=`` 
    &firstCls=`first`]]


    This is the HMtplFile chunk:

    <li class="th fix-height [[+firstCls]]">
    	<a href="[[phpthumbof? &input=`[[+path]]` &options=`&w=1000&h=750&zc=1`]]">
    		<img src="[[+idx:is=`1`:then=`[[phpthumbof? &input=`[[+path]]` &options=`&w=380&h=300&zc=1`]]`:else=`[[phpthumbof? &input=`[[+path]]` &options=`&w=150&h=100&zc=1`]]`]]">
    	</a>
    </li>

      Lucy Iannotti
      Following Sea design & development
      http://www.following-sea.com
      New Bedford, MA
    • suggestions:
      1) make your own snippet
      or
      2) use phpthumbon instead
      3) use next near img:
      <img src="[[phpthumbon? &input=`[[+path]]`
      &options=`[[+idx:is=`1`:then=`&w=380&h=300&zc=1`:else=`&w=150&h=100&zc=1`]]`
      ]]">
      

      4) use javascript or jquery to add .first class to your first li item. [ed. note: viktorminator last edited this post 10 years, 7 months ago.]
      • Thanks - I'm not familiar with phpthumbon... Will check it out.

        (My snippet-making skills are fairly non-existent at this point.)

        Edit: Maybe you meant I should use phpthumbof? Because I can't seem to find a phpthumbon snippet. I know there are a few other snippets based on phpthumb, but can't find that particular one. [ed. note: lucy last edited this post 10 years, 7 months ago.]
          Lucy Iannotti
          Following Sea design & development
          http://www.following-sea.com
          New Bedford, MA
        • Hi Victorminator, I'm assuming you meant to use the phpThumbOf snippet, so based on your suggestion I tried:

          <li class="th fix-height [[+firstCls]]">
          	<a href="[[phpthumbof? &input=`[[+path]]` &options=`&w=1000&h=750&zc=1`]]">
          		<img src="[[phpthumbof? &input=`[[+path]]` &options=`[[+idx:is=`1`:then=`&w=380&h=300&zc=1`:else=`&w=150&h=100&zc=1`]]` ]]">
          	</a>
          </li>


          That is making all thumbs the same size as the first thumb (&w=380&h=300) so it is not recognizing the "else". Correction: it is not resizing any of the thumbs at all. If I call phpthumbof uncached using the above options, it resizes all the thumbs to the "else" parameters.

          Any thoughts? [ed. note: lucy last edited this post 10 years, 7 months ago.]
            Lucy Iannotti
            Following Sea design & development
            http://www.following-sea.com
            New Bedford, MA

          • Also would love to know what I'm doing wrong with the first class property... Does anyone out there have a working example?
              Lucy Iannotti
              Following Sea design & development
              http://www.following-sea.com
              New Bedford, MA
            • I'm bumping this because, well, I really need a solution and from reading the docs it seems it should work.

              Does anyone have a working example using the &firstCls property in FileLister?

              And/or using IDX filter with phpThumbOf?
                Lucy Iannotti
                Following Sea design & development
                http://www.following-sea.com
                New Bedford, MA
              • Looking at your code, the a tag shouldn't be using phpthumbof, that can only be applied to the img itself.

                By the way, there is in fact a phpthumbon extra wink

                Anyway, using the defaults for the most part seems to work...
                <table>
                [[FileLister? &path=`assets/files/` &firstCls=`first`]]
                </table>

                Looks like you should be using [[+cls]] in your tpl to get the classnames. It's always best to simply copy the default tpl into your chunk, make sure that works the same, then start modifying it to your needs.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                • Thank you!!! There were no default tpl chunks with FileLister -- did you have these upon install or did you go digging somewhere else for them? Anyway, I should have looked at the snippet properties and maybe would have seen the [[+cls]]. It works! So now I have half my problem figured out.

                  Next up: to be able to produce a different sized thumbnail for the first row. I found phpThumbOn on Github. Russian! This will be fun. (Actually Google translate does a surprisingly good job with Russian.)

                  I'm wondering if I need to uninstall phpThumbOf before installing phpThumbOn...? And maybe do a shot of Stolichnaya for good measure. (It's almost noon.)

                  Also, the href for those a tags are images, as this is a carousel. So phpThumbOf is happy doing its thing there.
                    Lucy Iannotti
                    Following Sea design & development
                    http://www.following-sea.com
                    New Bedford, MA
                  • You can find all four tpls at core/components/filelister/elements/chunks/. Most extras will have their default chunk tpls there, and not always installed in the database.

                    phpthumbon is available through the Package Manager. [ed. note: sottwell last edited this post 10 years, 7 months ago.]
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                    • Thanks, good to know where to look for default tpls.

                      I was also looking at pThumb and phpThumbsUp. At least in the case of pThumb they say not to have it installed at the same time as phpThumbOf; so now I am wary of having more than one installed at a time. But will let you know what I learn.
                        Lucy Iannotti
                        Following Sea design & development
                        http://www.following-sea.com
                        New Bedford, MA