We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20203
    • 2 Posts
    Matt,

    You might be interested to know that static resources work like a charm with the latest SVN build. Hope that helps you out.
      • 18654
      • 191 Posts
      Thanks for the update - just downloaded rev6851 and Static Resources are working great on my localhost.
        God does not save those who are only imaginary sinners. Be a sinner, and let your sins be strong, but let your trust in Christ be stronger, and rejoice in Christ who is the victor over sin, death, and the world.
        • 18654
        • 191 Posts
        I’m running rev6851 on W7 / Wamp 2.0 / Chrome. Although the Static Resource Downloads are now working, as soon as I add a template they no longer work (I get 0kb download).

        My goal in adding a template was to run a snippet that would determine if the user was permitted to download this particular resource. I know this can be accomplished by placing the resource in another context or by using a plugin, but neither of these are ideal for the following reasons.

        1. For a plugin I would have to run code on every page request that only applied to a small amount of page requests. This seems inefficient. I would prefer to run the authentication script only when resources that require authentication are requested.

        2. If I use another context, this breaks my navigation and friendly URL structure. Plus, I think I would probably still need a plugin.

        My questions are:

        1. Should I be able to use a template with Static Resources?

        2. Is it possible to run a snippet from a Static Resource template that runs before the download commences (and can disable the download via a redirect header)?

        -matt
          God does not save those who are only imaginary sinners. Be a sinner, and let your sins be strong, but let your trust in Christ be stronger, and rejoice in Christ who is the victor over sin, death, and the world.
          • 22303 MODX Staff
          • 10,725 Posts
          Why wouldn’t you use Resource Groups to protect the downloads using the built in security system? And no, templates are not recommended for binary content types; though this has nothing to do with it being a Static Resource or not.
            • 18654
            • 191 Posts
            I thought resource groups were only for controlling access in the manager context. I’ll have to look into that some more. As far as templates, it seems a bit limiting to not be able to use templates with static resources binary content. For example, take a look at this page on our website.

            In the "Recommended Resources" area, each item extracts data from Template Variables related to a resource. Currently they’re all set to "Buy Now" which links to an external resource. However, we will also be offering "Free Downloads," in which case I would like to use Static Resources with TV’s for fields like "Author," "Summary," "Title,", "ShowOnRecommendedPage", "FreeDownloadAvailabilityStartDate" etc. Even the existing "Buy Now" resources would be better suited for a WebLink rather than a modDocument, but I can’t seem to get a full RTE as a TV with a webLink.

            How would you suggest handling a scenario where one wants to list downloads with custom fields associated with each item?

            Also, if I use resource groups for controlling access to downloads, would I be able to redirect to a page of my choosing or would the 404 default page be my only option? There might be different reasons why a user is denied access to a resource and it would be helpful to let them know what that reason is. I’m not sure that that would be possible without running a snippet when the page is requested.

            EDIT:
            One other factor. The client specifically wants to avoid having clients login (I’m not sure if this is required for resource groups). Additionally, he wants access to downloads to be controlled via the ConstantContact API. Each resource will be associated with a "List" in our ConstantContact account. Some resources will be made available if the user is willing to provide us with an email address. Other resources will require that they provide physical address and phone. Given the client’s specifications I don’t think resource groups would work in this scenario. Correct me if I’m wrong.

            Thanks for the input!

            -matt
              God does not save those who are only imaginary sinners. Be a sinner, and let your sins be strong, but let your trust in Christ be stronger, and rejoice in Christ who is the victor over sin, death, and the world.