I'm working on two sites with functionality spread over a MODx Revolution (2.2) install and a MODx Evo (1.0.4) install, in different folders on the same server.
I need to execute some complex snippets on the Evo install from within a manager processor in the Revo install, hopefully using something like $evo->runSnippet('snippetName'). Yeah, I know...
I've tried using the MODxAPI code to get an instance of Evo from within Revo, but I always get an error 'Could not load DBAPI class.' I put this down to the fact that the constants MODX_BASE_PATH etc are being defined in Revo and the wrong definitions are being used when I try to load an instance of Evo.
Has anyone achieved something similar to this? Is it in fact possible as those constants appear throughout critical pieces of code within Evo?
I'm thinking another option would be to make the Evo snippets web accessible and run them as ajax-style processors instead. It's not nice, but if I can secure them would that be a sensible alternative?
I'm not sure it's possible. The Evo snippets would want to use their own config and the connection to the Evo DB, neither of which will be available.
I think you could have both sites use the same database but with a different table prefix. Then maybe you could translate the Evo snippets for Revo and use them there with some PDO to get the data form the Evo DB.
The AJAX request sounds reasonable if you can secure it.
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html
Hi Bob, thanks for the quick response.
Both installs are already established in different databases and folders and there's zero chance of moving them for this purpose. I'm already using xpdo to get data from the Evo database but unfortunately these snippets are too complex to just translate over.
I'm just really wondering if it's possible to get around the clashing config options...
-
☆ A M B ☆
- 24,524 Posts
You should be able to use AJAX to run the snippet (put the snippet in an Evo resource with no template). You might need to use an Evo wrapper snippet to supply any passed parameters in the AJAX request. The wrapper snippet could also help in securing the Evo page if you pass a required value in the AJAX request.
can't you get the evo-datas serverside with cURL, the same way as you would do it clientside by ajax?