We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Everett, one word of warning about turning that System Setting off: If you're developing an extra, try it with that turned on before releasing it. I can't tell you how many times I've had extras that didn't work with it turned on. When you create a new resource, MODX can't see it because it's not in the alias map. The makeUrl() call fails and everything falls apart.

    Hopefully, this is fixed in 2.2.8, but I haven't had time to test it.

    In any event, it's a good practice to test your extras with the default MODX System Settings.
      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
    • Thanks for the heads up! I wonder what causes the problems...
        • 3749
        • 24,544 Posts
        I think the alias map is not updated until the next request. So if you created a resource and tried to forward a user to it, makeURL() which wasn't smart enough to check the DB if the resource ID wasn't in the alias map, would return null and the forward would fail.

        The solution was to call $modx->reloadContex() before makeUrl(), but from what I've heard, in 2.2.8, makeUrl() checks the DB if it can't find the ID in the alias map.

        Before I discovered that, I was making the URL myself using index.php?id=n.

          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
        • I built a classified ads site last year, and ran into this problem. The user would fill out the form and I simply had the Resource injected from FormIt input combined with their modUser credentials.

          I then dumped the user to a "Thank you" page which added a link to their new ad. I am not on that system right now, so I can't look at the code I used, but if memory serves by having FormIt drop the out put into the page and asking MODX Revolution to create the link via the [[+id]] it would get into the alias map.

          I will see if I can remember to check the code in the morning.
            Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

            Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
            • 3749
            • 24,544 Posts
            Another solution is to forward the user to an intermediate page containing a snippet that forwards them on to the target using makeUrl() from the ID in a $_SESSION variable. That works because the alias map is refreshed during the request to the intermediate page.
              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
            • Is it possible to just clear that cache partition after you've added a resource? I would guess it's a page request on the front-end that triggers the lookup in the aliasMap...
                • 3749
                • 24,544 Posts
                Clearing the cache hasn't helped when I've tried it -- even a complete refresh(), though I don't think I've messed with it since 2.2.4 or earlier.

                  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
                • I had to go in and manually remove the Frozen URIs to fix these. I guess I could have done it in a quick loop.

                  Essentially visit the page, go to the settings tab, place a check mark in Freeze URI and then clear the one that is shown. Re save the page. It should fix it.


                  This is probably a bug... I have seen it too often lately, especially on duplicated resources.


                  Quote from: Everettg_99 at Jun 04, 2013, 03:23 PM
                  I'm losing my mind on this. My error logs grow to 40 mb or so in a single day, and all the messages are stupid things from "bad" URLs. I've been digging around in the database for weeks now. Why is this happening? Why can't MODX figure out what's the correct URL? How can this be fixed? I want my error log spotless. I want it empty. If a single thing gets written to it, I want alarm bells going off. Instead I have firehose that can't be turned off.

                  [2013-06-04 11:18:27] (ERROR @ /connectors/system/settings.php) Resource URI locations/xxxx/raystown-lake-visitor-center.html already exists for resource id = 1256; skipping duplicate resource URI for resource id = 1729
                  [2013-06-04 11:18:27] (ERROR @ /connectors/system/settings.php) Resource URI locations/yyyy/jc-blair-memorial-hospital.html already exists for resource id = 996; skipping duplicate resource URI for resource id = 1612
                  [2013-06-04 11:18:27] (ERROR @ /connectors/system/settings.php) Resource URI locations/zzzz/standing-stone-coffee-company.html already exists for resource id = 1356; skipping duplicate resource URI for resource id = 1357


                    Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

                    Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com