We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15987
    • 786 Posts
    Dimmy,
    I think what needs updated is probably the FlexSearch, so it actually searches all content on a page regardless if it is in a chunk or tvar. I’m not sure if anyone has started to try and get that working or not, but it will be a mjor undertaking. I will keep this in mind though if we don’t see some work done on the search sometime soon.

    Quote from: sottwell at Jun 29, 2006, 07:11 AM

    Use TVs instead of chunks. Those can be searched.

    Which version of the search does this?
      • 23383
      • 138 Posts
      I have a little problem ... :s

      I’m using the Default Form, the default snippet, and my call is :

      [!FileDownload?getFolder=`assets/files/filedownload/`&browseDirectories &chkDesc=`fileinfo`&tplList=`FileDownloadForm`&downloadCount=`1`&userSort=`type` &sortOrder=`desc`!]

      But I have a big problem : I see the files, I can download a file (like readme.txt), but when I’d like to see the contents of a folder, he wanted to download the folder instead.... :s
      I mean, the snippet considers the folder like a file.

      How do I change that ?

      I’m using 1.7 version of File Download (from MuddyDogPaws or Download repository, it doesn’t change anything), Mozilla Firefox 1.5/IE 6
      and Modx 0.9.2.1 I’ve seen there were problems with FURL disabled, so I enabled it, but it doesn’t change this problem.

      Note : When I see the links on this example, I can see relPath=/thefolderiwannasee and on my side, I have download.php?xxxxxxxx&filename=Myfoldername

      Thank you for your help =p
        • 15987
        • 786 Posts
        Try changing your snippet call to this:

        [!FileDownload?getFolder=`assets/files/filedownload` &tplList=`FileDownloadForm` &chkDesc=`fileinfo` &browseDirectories=`true` &downloadCount=`1` &userSort=`type` &sortOrder=`desc`!]
        



        If that doesn’t work try removing a parameter at a time, to see if it fixes it.

        Here is the template that I used for the directory browsing on my site:

        <h2>Downloads</h2>
        <table>
          <tr><td colspan="5">Current Directory: [+path+]</td></tr>
          <tr>
            <td></td>
            <td></td>
            <td>Size</td>
            <td>Date</td>
            <td>Count</td>
          </tr>
        <hr>
          <tr>
            <td>[+image+]</td>
            <td><a href="[+link+]">[+filename+]</a></td>
            <td>[+sizetext+]</td>
            <td>[+date+]</td>
            <td>[+counter+]</td>
          </tr>
        <hr>
        </table>
        
          • 15987
          • 786 Posts
          That only gets set if you have clicked on a directory, so since your directory links aren’t working the error is not there. The links for the directories get created at line #368:

          $addUrl = $modx->config['friendly_urls']? '?':'&';
          $fileLink = $currentPageLink . $addUrl . 'relPath=' . $relPath . '/' . urlencode($file['name']);
          $fileImage = '<img src="' . $imgLocat . '/' . $imgTypes['folder'] . '" alt="" />';
          $file['sizetext'] = '-';
          $file['name'] = '<em>' . $file['name'] . '</em>';
          


          Can you post a link so I can see what the output looks like?
            • 23383
            • 138 Posts
            Here is the link :
            http://127.0.0.1/website/assets/snippets/filedownload/download.php?path=YXNzZXRzL2ZpbGVzL2ZpbGVkb3dubG9hZC9ldHVkZXMv&fileName=1

            And here is a screenshot (The Folders are 1 and 2, and 1 isn’t empty...)
              • 23383
              • 138 Posts
               
              if ($canDownload) {
                          if (!is_dir($_SERVER['DOCUMENT_ROOT'] . '/' . $getFolder.$relPath . '/' . $file['name'])) {
                              if ($downloadCount) {
                                  $fullPath = base64_encode($getFolder.$relPath);
                                  $fileLink = $download . '?path=' . $fullPath . '&fileName=' . $file['name'];
                                  echo $fileLink;
                              } else {
                                  $fullPath = $getFolder.$relPath;
                                  $fileLink = $fullPath . '/' . $file['name'];
                                  
                              }
              


              Is it normal I found my folders when I echo $fileLink ?
                • 15987
                • 786 Posts
                Is it normal I found my folders when I echo $fileLink ?

                No,

                This line

                if (!is_dir($_SERVER['DOCUMENT_ROOT'] . '/' . $getFolder.$relPath . '/' . $file['name']))


                checks to see if the current file/folder is a directory. If it is a directory it should jump to line 368 otherwise it should process the code you posted.

                echo this just before the if statement and see what it is returning:


                echo $_SERVER[’DOCUMENT_ROOT’] . ’/’ . $getFolder.$relPath . ’/’ . $file[’name’];
                  • 23383
                  • 138 Posts
                  Just done it ^^

                  c:/program files/easyphp1-8/www/assets/files/filedownload/etudes//texte.txtc:/program files/easyphp1-8/www/assets/files/filedownload/etudes//readme.txtc:/program files/easyphp1-8/www/assets/files/filedownload/etudes//2c:/program files/easyphp1-8/www/assets/files/filedownload/etudes//1
                  


                  When i’ve seen this, i changed the ’/’, and put it after $file[’name’], but it didn’t worked.
                  I didn’t modify something nor in the snippet, nor in the includes.... :s Just echo the values sometimes.
                    • 15987
                    • 786 Posts
                    I think there is an extra / in your snippet call set the following parameter to this:


                    getFolder=`assets/files/filedownload`
                      • 23383
                      • 138 Posts
                      yeah, you’re right, but it doesn’t change for my folder, problem
                      Btw I use your snippet call now smiley

                      It seems that it doesn’t recognize the folder like a folder but like a file. Don’t know why. A problem with apache maybe ?