We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27330
    • 884 Posts
    is there any snippet out there to make Ditto read it’s replies from another domain?
    I have quite a lot of products I want to show them on 2 different sites.

    I’m sure i’m not the 1st genius to ask that but cant find the correct wording I guess. any ideas?

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Ditto uses the MODx dbapi, so it might be possible to use a snippet that opens a connection to the remote database, then uses $modx->runSnippet(’Ditto’, ...) then closes that connection. It should work, as long as both databases use the same table prefix.

      The original connection would then be active since you didn’t explicitly close it before opening the new one, and the rest of the parsing should continue normally.
        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
        • 27330
        • 884 Posts
        Great Susan thanks for the reply.
        can you think of any public snippet that open/closes the remote connection I can look at?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          This may be helpful http://wiki.modxcms.com/index.php/API:DBAPI:connect
            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
            • 27330
            • 884 Posts
            great thanks for the link.
              • 27330
              • 884 Posts
              So do I must choose a specific row to display as in the wiki example?

              I tried testing like this with breadcrumbs snippet but no go.

              //connect to separate mysql db
              $modx->db->connect('dbhost', 'dbtable', 'dbuser', 'dbpass', true);
              $html = $modx->runSnippet('Breadcrumbs');
              print $html;
              //disconnect
              $modx->db->disconnect()
              //reconnect to modx db
              $modx->db->connect();