Here is a simple proof of concept idea, master being the main site and slave being a seperate site:
usage:
create a chunk in your master installation named "global_elements_chunk1" ( no quotes )
global_elements_chunk1 content:
<p>this is global_elements_chunk1 content</p>
create snippet(s) named global_elements with the following code in your master and slave sites,adjusting the path to the file accordingly:
// master | slave
$page_type ='slave';
include 'C:/wamp/www/modx1012_xforum/assets/snippets/global_elements/global_elements.processor.php';
add snippet call to the top of your templates
[!global_elements!]
add the placeholder call to your temlates
[+global_elements.chunk1+]
create a file named global_elements.processor.php with the code below, modifying the database details in the slave section of the switch.
upload the file somewhere safe in your file system since there are database details shown.
defined( 'IN_PARSER_MODE' ) or die( '<b>UNAUTHORIZED_ACCESS_ERROR</b>' );
if( isset( $page_type ) ){
switch( $page_type ){
case 'master':
$chunks_table = $modx->getFullTablename( 'site_htmlsnippets' );
break;
case 'slave':
$master_db_server = 'localhost';
$master_db_user = 'root';
$master_db_password = '';
$master_db_name = '`modx1012_xforum`';
$master_db_prefix = 'modx1012_';
//connect to master db
$master_conn = $modx->db->connect( $master_db_server, $master_db_name, $master_db_user, $master_db_password, true );
$chunks_table = $master_db_prefix.'site_htmlsnippets';
break;
default: '';
}
$chunk1 = $modx->db->getValue( $modx->db->select( "snippet", $chunks_table, 'name="global_elements_chunk1"' ) );
$modx->setPlaceholder( 'global_elements.chunk1', $chunk1 );
if( $page_type =='slave' ){
//disconnect
$modx->db->disconnect();
//reconnect to modx db
$modx->db->connect();
}
}