We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42082
    • 72 Posts
    Hey guy lets say i have a file under the assets folder called gum ok? Then under that folder i had another folder called stride and in that folder a html file called index.html .
    In the index file can i call a chunk? Because i tried before to call a chunk in for the login change password snippet that i had made and all i get when i call it is the tag itself. Please explain this.
    Any tips on what might be wrong would be great.

    This question has been answered by BobRay. See the first response.

    • discuss.answer
      • 3749
      • 24,544 Posts
      MODX requests are routed through the index.php file in the MODX root, which loads MODX. Direct requests for a file won't go through the root index.php file, so MODX won't be loaded and can't process any tags for you.

      BTW, having a file available outside of MODX that triggers a password change would be a pretty serious security risk unless you really know what you're doing. Is there some reason you don't want to make the page a MODX Resource?
        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
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        You have to keep in mind that MODx only works through the index.php file. When the server gets a request for a page, it looks for a file in its web space (htdocs, www, public_html or whatever it's configured to use) of that name. If it finds such a file, such as your assets/gum/stride/index.html, then it simply serves that file, as-is. MODx has nothing to do with it at all.

        If the server does not find such a file, then it serves its 404 Not Found page or message.

        That's where "mod_rewrite" (for Apache) and other URL rewrite methods come into play. When using "SEO-Friendly URLs" and mod_rewrite, if the server doesn't find such a file, for example, about.html, it will then follow its rewrite rules. In the case of MODx (and many other CMS type applications as well) it does a fairly simple rewrite of the requested URL. It rewrites the URL to something like "index.php?q=about". Now when it looks again, it finds the MODx index.php file, and happily turns it over to the PHP processor like any other .php file.

        Now MODx gets involved, since our index.php file loads up the MODx class and tells it to process the resource with the alias of "about". And now our MODx tags get processed.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 9207 ☆ A M B ☆
          • 2,475 Posts
          I'm confused by the question here... if you have an index.html file, it can't just magically parse a MODx Chunk. What does MODx have to do with that file? Normally nothing.

          If you are using a Static Element, then yes: starting with one of the recent MODx releases, you can store Chunks/Snippets/Templates etc. as files on the filesystem and not just in the database. So if you had created a MODx Chunk, and you checked the box for it to be "static", AND THEN you told MODx to use your file as the source of that Chunk, ONLY THEN would that file do something special, but it would only do it if it were called by MODx (e.g. if you used it in a MODx template).
            • 42082
            • 72 Posts
            Oh now i get it sorry I was not thinking right.I am doing a website and i am using a jquery pluggin called extruder which creates a tab on the side of the window for storing information in. In my case I would like to make this tab hold all the user account stuff in it so at any point while on the site you could just click the tab on the side and BAM a panel would slide out with all your account data it is amazing. But extruder how it pulls in the pieces it needs is through links to a file which i store as assets/extruder/parts/ then the html chunk you want to load in. So in the html chunk in the parts folder i need it to be able to call the login snippet. But if I can't call a snippet in one of those chunks I will have to somehow make all the chunks into Modx chunks.

            see this site for more info on extruder... http://pupunzi.com/#mb.components/mb.extruder/extruder.html
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              You can load up the user data into an HTML container using a snippet, hide it with CSS, and use one of any number of JQuery popups, slide-outs, and other types of visibility toggling plugins.

              http://jqueryui.com/toggle/
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org