We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22827
    • 129 Posts
    Hello, I am sure I am missing something here.

    Lets say a content editor wants to upload a PDF, or some PDFs to their site, and put a link to it (them) on a page. The best way to do this, to keep things maintainable, is to upload the file then create a weblink to the file, and then use the weblink [~id~] to link to it in document content. Then if the PDF changes, you just update the weblink and any documents referencing the pdf will get the new file.

    They can use the file manager in modx to upload the file. But when it comes to creating a weblink, the only option appears to be to manually type the path to where the file is visible on the site.

    Using a TV in this instance doesn’t seem to be feasible as there could be any number of documents the content editor would want to link to.

    So how is this best approached?

    Thanks,

    Paul



      • 22770
      • 285 Posts
      You can make links directly to uploaded files. Click on the icon to the right of ’Link URL’ when you’re making a link and that takes you to the uploaded files.
        • 22827
        • 129 Posts
        Hmm.. I am still missing something.

        If I create a weblink, I don’t have "Link URL", but "Weblink" as the field to complete for the URL. If I click the icon next to it, I get the normal "open folder" image, which responds to clicking something in the document tree.

        How can I get the dialog up?
          • 7231
          • 4,205 Posts
          To use a weblink to link to a document you would need to input the file path manually. It does not provide specific support for linking to files, it is basically intended for linking to document/pages or remote sites.

          The TV is the only tool that provides the upload and file management features. Create a template to use for the ’file’ documents and add a file tv to it. Then rather than using [~id~] to generate the direct link use [*tvName*]. Then use ManagerManager plugin to hide all the fields that are not needed for the ’file’ documents (content, long title, etc..).
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don't know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 22827
            • 129 Posts
            Ah right I see.

            Yes, so the files are just TVs within documents specifically templated to be links to files.

            But if I want to add a link to the content section of another document, I cannot use [*tvName*] as that would be referring to a TV in the current document.

            How would I add a link created from a TV within another doc without a snippet?
              • 22770
              • 285 Posts
              Unless I’m not understanding you, I don’t know why you would make a weblink here at all.

              Here’s what I do:

              - Upload the file
              - Go to the page I want to link from
              - Highlight the relevant text (as though I was making an ordinary link) through the TinyMCE editor
              - Click on the link icon
              - Now when the link pop-up appears, I click on the icon to the right of ’Link URL’

              I’m guessing you’re trying to do something more complex, but I must admit I’m not sure what it is. Are you trying to link to a file from a navigation menu?
                • 7231
                • 4,205 Posts
                Check out the FileDownloadPE snippet and you can use the same [~xx~] syntax.
                http://scottydelicious.com/blog/2008/06/15/filedownloadpe

                I use it on a few site and it is the easiest way to manage downloads and it will conceal the actual file path.
                  [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                  Something is happening here, but you don't know what it is.
                  Do you, Mr. Jones? - [bob dylan]
                  • 22827
                  • 129 Posts
                  Quote from: PatrickSamphire at Apr 21, 2009, 07:55 AM

                  Unless I’m not understanding you, I don’t know why you would make a weblink here at all.

                  Here’s what I do:

                  - Upload the file
                  - Go to the page I want to link from
                  - Highlight the relevant text (as though I was making an ordinary link) through the TinyMCE editor
                  - Click on the link icon
                  - Now when the link pop-up appears, I click on the icon to the right of ’Link URL’

                  I’m guessing you’re trying to do something more complex, but I must admit I’m not sure what it is. Are you trying to link to a file from a navigation menu?

                  Yes, you are right - this is the most straighforward way to add a link. I am trying to take advantage of the "abstraction layer" that weblinks provide, by having the file referenced by a weblink, then reference the weblink in content.

                  So if you have a 1000 page site, and the pdf available on 100 pages, if you need to update the PDF to a new file, you update the weblink only.

                  But of course I need to weigh the value of doing this versus the complexity to the content editor.
                    • 22827
                    • 129 Posts
                    Quote from: dev_cw at Apr 21, 2009, 07:56 AM

                    Check out the FileDownloadPE snippet and you can use the same [~xx~] syntax.
                    http://scottydelicious.com/blog/2008/06/15/filedownloadpe

                    I use it on a few site and it is the easiest way to manage downloads and it will conceal the actual file path.

                    Ooh nice. Thanks that look great.
                      • 22770
                      • 285 Posts
                      Quote from: paulkoan at Apr 21, 2009, 08:14 AM


                      Yes, you are right - this is the most straighforward way to add a link. I am trying to take advantage of the "abstraction layer" that weblinks provide, by having the file referenced by a weblink, then reference the weblink in content.

                      So if you have a 1000 page site, and the pdf available on 100 pages, if you need to update the PDF to a new file, you update the weblink only.

                      But of course I need to weigh the value of doing this versus the complexity to the content editor.

                      Oh, okay, I get it now. laugh

                      Of course, you could just save the new PDF with the same name as the previous one. tongue