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

    I had these query . i am working for these company where its using Modx Rev for its blog content so these comany has branches in united kingdom and United states so they have two domain that is comanydomain.co.uk & comanydomain.com

    So for now they are using the Modx on comanydomain.co.uk with all the Blog Content . so on these website it has its uk address , phone no. etc
    And now they what the same content on comanydomain.com with all same blog content but USA address , phone no. etc


    Q1) And the problem is that the content Writer will have to do changes on both the dashboards if we have two dashboard for diffrent domain.
    Q2) so is it possible to have the same content on both the website but diffrent contact pages and no.
    Q3) Is it possible to use the same dashboard for both website with same content but diffrent layouts and pages ( address , contact etc )

    Note : both the websites will be hosted on the same hosting .

    Q4) Where does Modx store it contents ( blog information and text )
    Q5) so i was thinking if i just clone ( omanydomain.co.uk copy) the full modx directory and paste in the comanydomain.com directory and i dont change the database file use the same database . and so when i do changes on one dashboard it will change on both ( as its the same database )

    Thank you
    Cheers
      • 17301
      • 932 Posts
      I'm sure someone will reply with more details but yes it's possible by using multi contexts. Take a look at the XRouting extra and documentation for guidance. You can use pdoResources/getResources to pull in content from the different contexts and that will enable you to share the blog posts between the two sites whilst retaining their ability to have their own templates, chunks and snippets. It becomes potentially messy when you want to have registered users between the two sites also but again still perfectly possible.
        ■ email: [email protected] | ■ website: https://alienbuild.uk

        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
        • 3749
        • 24,544 Posts
        To stick to a single dashboard, separate contexts are one way to go.

        Another way, since the sites are so similar, is to just put the content that is different into files, all in the same directory (myfiles) and create a snippet (let's call it "CorrectFile") that detects the URL and returns the content of the correct file. Say you have two banner files called usbanner.html and ukbanner.html -- put a tag like this where you want the content to appear:

        [[!CorrectFile? &fileName=`banner`]



        /* CorrectFile snippet */
        $myFileBase = MODX_BASE_PATH . 'myfiles/';
        
        $fileName = $modx->getOption('fileName', $scriptProperties', '', true);
        
        $url = $_SERVER['REQUEST_URI'];
        
        if (strpos($url, '.uk', !== false)) {
            $prefix = 'uk';
        } else {
            $prefix = 'us';
        }
        
        $fileName = $myFileBase . $prefix . $fileName . '.html';
        
        $output = file_get_contents($fileName);
        
        if (empty($output)) {
           $output = 'File ' . $fileName . ' not found';
        }
        
        return $output;


        Once this is working, it can be used with any pair of files as long as files with the 'uk' and 'us' prefix exist and you send the un-prefixed file name to the snippet in the snippet tag:


        [[!CorrectFile? &fileName=`footer`]


        Now the two sites can have identical content as long as the URLs are different for the US and UK sites.

        Once it's all working, you can also put the content in chunks with the uk and us prefix and make them static chunks. The content of static chunks is saved to a file. Specify the path to the directory with the files when you make the chunks static. That way users can edit the us and uk chunks in the Manager and their work will be saved to the files.

        Actually, it will be easier and safer to create the static chunks first and make sure their content is saved to the correct directory. That way you never have to work on the files directly.
          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