We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39927
    • 46 Posts
    I have successfully edited and placed the code to place "header_for_guests" and "header_for_members" chunks on my pages, and it works beautifully.

    However, I want to do the same thing on some pages that are outside of the MODX folder. So ... on those pages, how do I make this code work? :

    [[!Personalize? &yesChunk=`header_for_members` &noChunk=`header_for_guests` &ph=`name`]]
      Alan
      --------------------------------------------------------
      MODX Revolution 2.2.2-pl
      • 3749
      • 24,544 Posts
      I'm not sure what you mean. MODX pages are usually in the database, not in any folder.

      If you want to display the contents of a file that's outside of MODX root, you'd have to write a custom snippet that would get the file with file_get_contents($filePath) and then use getChunk and str_replace() to replace the placeholders as appropriate.

      It would be a lot easier to just move the files into MODX. Is there some reason not to do that?


      ------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using.
      MODX info for everyone: http://bobsguides.com/modx.html
        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
        • 39927
        • 46 Posts
        If I move the files into MODX, then the url isn't "pure." I mean, instead of "MySite.com" the site becomes "MySite.com/modx/"

        Being new to MODX, I know I'm thinking "old school" ... but "index.php" in the root is what makes "MySite.com" happen. If I put everything in the modx folder, then what happens when people go to "MySite.com" ... ?

        What is it that I don't get, Bob?

        Thanks.

        Alan
          Alan
          --------------------------------------------------------
          MODX Revolution 2.2.2-pl
          • 3749
          • 24,544 Posts
          Definitely old school. wink


          In MODX, index.php is essentially a dispatcher (and MODX won't work without its own index.php file there). All page requests to a MODX site are routed through index.php. MODX handles the request through code called in index.php, generates the page from the DB (including an appropriate URL), and sends it off to the browser.

          In MODX Revolution, you can actually specify the specific URL for each page on the site on the Create/Edit resource (document) panel.


          See the site in my sig. for more info on how MODX works.


          ------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using.
          MODX info for everyone: http://bobsguides.com/modx.html
            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
            • 10208 ☆ A M B ☆
            • 1,780 Posts
            You can display "pure" url's with .htaccess and FURL's (MODX System Settings and .htaccess - see Friendly URL's documentation). However, with MODX in a sub directory it will show the subdirectory unless you tell it not to with .htaccess. There's good information about this here: https://forums.modx.com/thread/?thread=73312#dis-post-410056

            The FURL's documentation is here: http://rtfm.modx.com/display/revolution20/Using+Friendly+URLs

            I'm a little confused about how you're structuring the site and why.

            How are you distinguishing between members and guests? The personalize snippet does what? Are you using permissions to log in members? I ask because your entire site, both guest and member should be within MODX as Bob mentioned.

            Additionally, if you're going to use the "mysite.com" exclusively for the MODX content, you could just install it into the root and enable FURL's.
              Frogabog- MODX Websites in Portland Oregon
              "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
              Having server issues? These guys have MODX Hosting perfected - SkyToaster
              • 39927
              • 46 Posts
              Thank you both for your time and attention.

              At present, with only a week or two of learning about MODX ... and having never used *any* software to build sites before (I've been building sites for 12 years - front end only - with a very unorthodox style of writing all my own coding by hand) ... I imagine you're both a bit confused about how I'm structuring the site because I, myself, am confused about this new approach for me.

              I'll do some more educating, thanks to you guys for taking the time to point me in the right direction, and get my structuring corrected.

              Thanks again ... and I'll report back here to let you know my progress.

              Alan
                Alan
                --------------------------------------------------------
                MODX Revolution 2.2.2-pl
                • 10208 ☆ A M B ☆
                • 1,780 Posts
                Read everything on Bob's site and get yourself a copy of the Official Guide to MODX. The online documentation is sometimes vague unfortunately. Bob's book is not, and well worth the cost. I think a lot of people would agree that having it available when first working with MODX would have saved countless hours researching and puzzling it all together. I'd suggest reading it cover to cover for the fullest benefit.

                You might also want to look at some of the online tutorials and videos available by searching with "modx" added on google and if all else fails (or rather, in conjunction with...) defaulting to the official documentation and asking here.

                I am particularly fond of Design from Within's videos and tutorials, and make sure you visit Susan Sottwell's tutorials as well.

                Welcome to MODX. If you've been building static sites all this time you'll be pleased with both the automation possibilities as well as the freedom to write your code any way you see fit.


                [ed. note: frogabog last edited this post 14 years, 3 months ago.]
                  Frogabog- MODX Websites in Portland Oregon
                  "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
                  Having server issues? These guys have MODX Hosting perfected - SkyToaster
                  • 39927
                  • 46 Posts
                  Yup ... I've been on Susan's site, and all over YouTube, and I agree the online tutorials are quite frustrating at times.

                  Being able to write my own code; to use my own template designs -- is what made me get serious about learning MODX!

                  I ordered Bob's book last week and can't wait to get it. I really want to get familiar with MODX and master it ... I'm sure it is going to give me the ability to do back-end work - finally!

                  And, again, I really appreciate your quick responses and help.
                    Alan
                    --------------------------------------------------------
                    MODX Revolution 2.2.2-pl
                    • 39927
                    • 46 Posts
                    Wow. Design from Within's web site really **is** interesting! I'll be digging in there when I get some time!
                      Alan
                      --------------------------------------------------------
                      MODX Revolution 2.2.2-pl
                      • 3749
                      • 24,544 Posts
                      @Frogabog -- Thanks so much for the kind words.

                      @alanhorvath - There's also some great information for MODX beginners here: http://codingpad.maryspad.com/category/modx/


                      ------------------------------------------------------------------------------------------
                      PLEASE, PLEASE specify the version of MODX you are using.
                      MODX info for everyone: http://bobsguides.com/modx.html
                        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