We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3677
    • 130 Posts
    http://bugs.modx.com/issues/3942

    This seems like a really basic thing that is missing. Or am I missing some trick here?
    I need to have some organizational folders in the resource tree that are not rendered in the URL.
    I also need some parent folders that ARE rendered in the URL.

    If I turn off "Use Alias Path", I have to prepend the alias with my folder name for every single doc that needs this and that is a bit much.

    -Brian

      • 22303 MODX Staff
      • 10,725 Posts
      You can use the new Freeze URI feature and specify the complete URI for Resources you do not want to include parent aliases when use_alias_path is enabled, or for those you do want to have custom parent paths, if disabled.
        • 3677
        • 130 Posts
        Thanks Jason. The Freeze URI option is some help, but it is certainly no replacement for being able to ignore alias path for an entire container. It's a problem when you have a lot of resources of both types as you have to edit a lot of resources either way.

        I think this needs to be an added feature, but I would also love to see the "Batcher" plugin expanded to allow mass editing of any resource field and not just tvs. If I could apply Freeze URI checkbox to all resources using a specific template for example with Batcher that would ease the pain for situations like this and many others. [ed. note: bmilton last edited this post 15 years, 1 month ago.]
          • 27716
          • 126 Posts
          Hi Guys,

          I have a question that probably matches this thread.

          Is it possible with a snippet to Set the Freeze URL to On, and then add the required URI?
          I am haveing users create docs and want all of one container to have frozen URIs.

          Stuart



            • 3749
            • 24,544 Posts
            I think it would have to be a plugin connected to OnBeforeDocFormSave.

            It's definitely doable, and I don't think it would be very complicated.
              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
              • 19328
              • 433 Posts
              Hi smcilreavy, did you ever get to try the plugin approach BobRay mentioned? Did you get it to work?

              I would also like to freeze the URI for all documents in one container (remove the container's name from the URI's). But I'm not sure how to do it. I'm going to try some things and I'll report back if anything works.
                • 19328
                • 433 Posts
                Surprisingly I seem to have this working!

                I created a plugin connected to OnBeforeDocFormSave like BobRay said.

                The plugin code:

                <?php
                $parent= $resource->get('parent');
                
                if ($parent == '5') {
                     $alias = $resource->get('alias');     
                     $resource->set('uri_override', '1');     
                     $resource->set('uri', $alias);
                     $resource->save();
                  }


                For now I manually fill in the parent id that has to be hidden from the URI (in this case 5). Maybe it would also be possible to create a TV with a checkbox 'hide from URL' for the parent, and check if it has been checked and use that.