We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25519
    • 265 Posts
    BobRay
    Thanks a million for rustling this up smiley
    I’ll integrate and test as soon as I get the chance, but it will have to wait a little while as I’m firefighting right now. Will feedback as soon as.
      • 25519
      • 265 Posts
      BobRay
      Added this snippet but it’s currently breaking the pages, namely i’m just getting a plain white page - tried calling snippet directly in the doc and also the template (via a chunk)
      Possibly this is a file/doc name conflict - please bear with me and i’ll work on seeing if i’ve made an obvious error in what i’ve added to the assets/files/ directory, but it will have to wait a little.

      Really appreciate your help, will get back asap.
        • 3749
        • 24,544 Posts
        Sorry, I corrected some errors in the code and tested it. Use the code in the message above.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 25519
          • 265 Posts
          Okay, tested

          Here’s the name/location of the download document:
          assets/files/4 The Pavement, St Ives.docx

          Here’s the name of the resource:
          4 The Pavement, St Ives

          For the time being I’m adding the snippet call directly into the resource content but could sort this into the template later.

          What I’m getting returned on the page is: .docx - which is a page link w.siteroot/.docx

          Do you think there’s a file/resource naming prob here?
          I can’t change this format as i’m using loads of ditto to display the company’s properties based on [+pagetitle+]

          Thanks

            • 3749
            • 24,544 Posts
            I’m not sure. I tested it on my local machine and it worked fine, but the pagetitles were all a single word. Just to see, try it on a document with no spaces or commas in the pagetitle and see what you get.

            Make sure you’re using back-ticks, not single quotes, around the parameter in the snippet call.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 25519
              • 265 Posts
              I generated a pagetitle AAA and a tested first with AAA.docx and then AAA.pdf and get exactly the same - the link as .docx ot .pdf but nothing else, and these link to w.domainname.com/.pdf or /.docx both of which are non existent.

              I changed page name and it knocked out the link, so that proves the snippet is adding the link. The /files directory is set to 777 on the server and the documents to 644.

              I’ll try setting this up on my local to see if it works differently - will let you know the results

              Thanks for the perseverance
                • 3749
                • 24,544 Posts
                You’re not using PHP4 by any chance? smiley

                I added a PHP4 compatibility section in the post above.

                Also, you’ll need at least PHP 4.3.0 for the glob() function to work.
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 36624
                  • 535 Posts
                  Quote from: rootsdiv at Oct 01, 2009, 10:56 AM

                  Hi

                  The doc formats will be either Word or PDF. For the record, Each property is a seperate document (resource) and all are rendered via ditto.

                  Ideally, for each property I would like the content editor to be able to upload a Word/PDF file to link to via the resource manager, just like adding a new image. Editor then creates text hyperlink to the file. End user downloads the file via the text link.

                  Is this feasible?
                  My english is bad and maybe i misunderstood the real challenge of this thread ...
                  why dont you use a TV type FILE ? then hide the TV with PHx if empty ...

                    CTRL+SHIFT+U - Clear Cache
                    CTRL+SHIFT+H - Hiding Heft Panel
                    CTRL+SHIFT+N - Fast Create Resource
                    CTRL+ALT+P - Preview Recource (in edit resorce window)
                    CTRL+ALT+S - Save
                    • 3749
                    • 24,544 Posts
                    Quote from: manu at Oct 09, 2009, 02:15 PM

                    [My english is bad and maybe i misunderstood the real challenge of this thread ...
                    why dont you use a TV type FILE ? then hide the TV with PHx if empty ...

                    I think the OP want’s to upload files with the same filename as the document pagetitle and have them displayed automatically, without knowing ahead of time how many files will be attached to each document. That way, there’s no need to manually set all the TVs.
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 3749
                      • 24,544 Posts
                      BTW, for some users, a link to a .doc or .pdf file will launch Word or Adobe Reader rather than give a download option. I don’t think there’s any way to stop this other than adding a content-disposition header to each downloadable file designating it as an "attachment." In MODx revolution, you can create a Static Resource for each file and set the content-dispo field to "attachment" but I dont know if there’s any way to do this in Evolution.
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting