We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42892
    • 44 Posts
    Hi, I wanted to write a simple plugin to override some settings if the site gets requested over a different domain than the main domain. I already could change the site_url setting, but now I am stucked by finding the system-event where I can change the site_name.

    Does anyone know which system event I need to use to do so?

    Thanks already smiley
      • 9207 ☆ A M B ☆
      • 2,475 Posts
      You may want to consider using Contexts to create variations of the settings you want to change.
        • 3749
        • 24,544 Posts
        You've probably thought of this, but you could also add a rewrite rule to .htaccess so everyone comes in on the same domain. Having different users on different domains will generally cause all kinds of session problems unless, as Everett suggests, there are different contexts, and that creates its own problems.
          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
          • 42892
          • 44 Posts
          Quote from: Everettg_99 at May 22, 2014, 12:13 AM
          You may want to consider using Contexts to create variations of the settings you want to change.

          I would like to, but I have the same content in both websites. In order to keep it simple for the client I can't say he has to manage two contexts when the content is the same. But thanks smiley



          Quote from: BobRay at May 22, 2014, 01:05 AM
          You've probably thought of this, but you could also add a rewrite rule to .htaccess so everyone comes in on the same domain. Having different users on different domains will generally cause all kinds of session problems unless, as Everett suggests, there are different contexts, and that creates its own problems.

          Yes I thought of that, but a requirement was that the site can be accessed via two different domains (which stay as base-path <base href="URL"/>). And yes it is also a requirement that Google and co indexes both Domains - just to prevent this question wink

          I was told that there should be a possibility to manipulate the cache over the API. But I didn't checked this yet. If someone has done this before I would apreciate the help! smiley

          Thanks already to everyone reading this. I wish you a productive day smiley
            • 4172
            • 5,888 Posts
            with migxMultiLang we change some system-settings with this plugin:

            https://github.com/Bruno17/migxmultilang/blob/master/core/components/migxmultilang/elements/plugins/mml_initculture.plugin.php

            caching different output for each domain is another story.

            You can put the whole template into a chunk and call that chunk with getCache.
            This way, its possible to create a cached version of the resource-output for each domain.

            This is how we do it with migxMultiLang and the mmlCache-snippet.
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 40045
              • 534 Posts
              What about a combination of $modx->setPlaceholder('+site_name', 'On the fly generated site name replacing system/context setting'); and OnHandleRequest event? I can do it like that^^...same would probably go for site_url
                • 42892
                • 44 Posts
                Quote from: exside at May 25, 2014, 09:10 AM
                What about a combination of $modx->setPlaceholder('+site_name', 'On the fly generated site name replacing system/context setting'); and OnHandleRequest event? I can do it like that^^...same would probably go for site_url

                Well that would be "a solution" but since the question popped up it would be nice to know the entry point for such a task.

                But thanks, I din't thought of this smiley

                Have a nice day everybody!