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

    Hi guys, I make this as an official hack from me to MODx. Waiting for the core team to decide whether it’s going to be implemented for the future release or not.

    This hack will allow multiple domains to be hosted on one MODx installation base. Manager able to setup the desired strart doc id and error doc id for each subsites under System Settings configuration page. This mostly affect friendly alias path that is being turned on.

    Now it provides root folder for the subsites to be located anywhere, without the needs to located them right on the first level or root level. The alias itself can be anything as well, doesn’t have to be the domain/subdomain name.

    It has been tested for several minutes by me. If somebody willing to test this further, it will be great.
    PS: Modification doesn’t affect any usability of using other resources created for MODx, due to the fact this hack changes all the needed API to keep everything act as if there is no modification at all.

    Here is a little scrrenshot for the system setting page
      Wendy Novianto
      [font=Verdana]PT DJAMOER Technology Media
      [font=Verdana]Xituz Media
      • 18397
      • 3,250 Posts
      The actual MODx parser is in /manager/includes/document.parser.class.inc.php.

      Hope that helps!
        • 32963
        • 1,732 Posts
        Maybe you need something like an OnMakeUrl event so you can modify all your MODx generated urls from a plugin without having to hack the core, correct?
          xWisdom
          www.xwisdomhtml.com
          The fear of the Lord is the beginning of wisdom:
          MODx Co-Founder - Create and do more with less.
          • 32241
          • 1,495 Posts
          Yeap, actually I still need to hack the core though, I change the makeFriendlyURL() and makeURL() function to make sure that every friendly alias path need to be outputed, it will remove all the leading alias virtual directory, which based on the name of the domain being used.

          For example, "subdomain.domain.com/home.html". The "subdomain.domain.com" is the first folder level that is going to contain all the documents specific to that subdomain. So in this case, both of the methods, instead of outputing that, it will remove the "subdomain.domain.com", and return "home.html".

          Now the last bit that I need to change is executeParser() function, which is before the event onWebPageInit, I hack into the function and change $alias variable to be appended with "subdomain.domain.com", before the $alias variable being processed and returning the exact document.

          All the changes will only happen, when the alias path option being enabled in the manager setting. I also plan to have a new configuration setting, to enabled this mode, which allow subsite or not, if it is, then all the changes in that 3 functions will run, if not, it will proceed as standard MODx system.

          Do you think this is do able? Did I cover all the basic ground for subsite? I did the changes of the executeParser() function and it works.

          Please let me know if I do wrong, and I really appreciate all the helps, because I’m not a good PHP programmer, so any help from the core coder will be awesome.

          Thanks
            Wendy Novianto
            [font=Verdana]PT DJAMOER Technology Media
            [font=Verdana]Xituz Media
            • 32963
            • 1,732 Posts
            I think it’s workable but you just have to give it a try.
              xWisdom
              www.xwisdomhtml.com
              The fear of the Lord is the beginning of wisdom:
              MODx Co-Founder - Create and do more with less.
              • 32241
              • 1,495 Posts
              My last question, hopefully.

              Is there anyway to search document id based on their alias, other than going back and forth of the database? Is there any function available to do that? I haven’t check the API function yet, but if somebody could direct me, it will be great.

              How do I add a new option under manager setting inside the core code to have subsite disable or enable option?

              Jason, if you can give me a hint, it will be really2 awesome.

              Thanks
                Wendy Novianto
                [font=Verdana]PT DJAMOER Technology Media
                [font=Verdana]Xituz Media
                • 32241
                • 1,495 Posts
                I found this wonderfull array inside the core
                $modx->documentListing


                Can we use that for snippet as well? It has all the pages alias with the corresponsding pageid attached to it.

                It’s awesome.
                  Wendy Novianto
                  [font=Verdana]PT DJAMOER Technology Media
                  [font=Verdana]Xituz Media
                  • 32241
                  • 1,495 Posts
                  Thanks jason for the help, I have the subsites working just fine now, without having to use .htaccess.

                  I did a lot of hacking inside the document.parser.inc.php, but it’s mostly just adding a few lines of code to modify certain behaviour in producing friendly alias path, while on subsites mode. It also change the site start and error page to the parent folder for subsites.

                  All I need is to modfy the manager setting to have this option available for user to check or uncheck.

                  Btw, is there any thought of implementing madmage multi lingual solution? I think it will be a good start for modx to have multi lingual solution.

                  PS: Sorry if this post containing a bunch of topics, which are unrelated to the topic itself. Don’t ban me for this moderator. tongue

                  Regards,
                    Wendy Novianto
                    [font=Verdana]PT DJAMOER Technology Media
                    [font=Verdana]Xituz Media
                  • Wendy, we’ll be seriously evaluating when and what method for front-end multi-lingual sites very soon. smiley
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 32241
                      • 1,495 Posts
                      Quote from: rthrash at Jan 05, 2006, 10:00 PM

                      Wendy, we’ll be seriously evaluating when and what method for front-end multi-lingual sites very soon. smiley

                      That’s a good thing to know. Please update me when the time come. I’m looking forward for the future of MODx, by looking at the current progress right now, I can see the multi lingual content being implemented in the near future.

                      Btw, I’m done with subsites hacking, I added 2 options in manager system configuration setting to allow subsites or not, and it’s going to depend on their domain. I believe this subsites solution is only affecting user who want to use alias path.

                      If it is going to be implemented to the core, I wouldn’t mind sharing what I did with the code.
                      Hoping this could be on official option on MODx in the next release, including the multi lingual from madmage or whatever that you guys come up with.

                      Thanks for nurturing this system.
                        Wendy Novianto
                        [font=Verdana]PT DJAMOER Technology Media
                        [font=Verdana]Xituz Media