and especially the config.xml so that I can modify just that single file if I want to change the behavior of Juicebox in the future
A possible solution might be to set up a single XML file with the gallery configurations you'd like to use. Let's call it 'preset.xml'. (There would be no need to worry about any image data in this file. It would be used only for the configuration options.)
In your PHP file which generates the XML data for each gallery (pointed towards via the configUrl option), you could read the 'preset.xml' file and copy all the configuration options (the attributes to the opening <juiceboxgallery> tag).
Something along the lines of the following should work although you may need to modify it to suit your own needs.
<?php
$filename = 'preset.xml';
$values = array();
if (file_exists($filename)) {
$dom_doc = new DOMDocument('1.0', 'UTF-8');
$dom_doc->load($filename);
$settings_tags = $dom_doc->getElementsByTagName('juiceboxgallery');
$settings_tag = $settings_tags->item(0);
if ($settings_tag->hasAttributes()) {
foreach ($settings_tag->attributes as $attribute) {
$name = $attribute->nodeName;
$value = $attribute->nodeValue;
$values[$name] = $value;
}
}
}
$new_dom_doc = new DOMDocument('1.0', 'UTF-8');
$new_dom_doc->formatOutput = true;
$new_settings_tag = $new_dom_doc->createElement('juiceboxgallery');
foreach ($values as $key=>$value) {
$new_settings_tag->setAttribute($key, $value);
}
}
// Create image data here
$new_dom_doc->appendChild($new_settings_tag);
echo $new_dom_doc->saveXML();
?>
Alternatively, if you have only one embedding code block, you could simply set your configurations in your embedding code, rather than in the XML file. Please see here for details.