Thanks for a great program. I converted the config file to a php file, so I could easily pass variables to it. I stumbled a couple of times, but thought I'd post my code here, so an arm chair coder like myself may be spared a few minutes. I'm sure there's probably an easier way to do this, but I'm self-taught, and this is what I came up with.
To convert the config file to php, replace the existing header line with the following, and change the extension to php:
<?
header("Content-Type: application/xhtml xml; charset=UTF-8");
?>
To pass a variable to the php file I found I needed to use the full URL. A relative path doesn't work on my server, or perhaps any server. But you may run into a problem (as I did) with the error "Juicebox Error: Config XML file not found" if your site is accessed both from www.mysite.com and just mysite.com. I wrote the following little workaround for that, so the full URL path would be compatible regardless of how the site is accessed:
This code detects if your guest is using "www" or not.
<?
$isWWW = substr($_SERVER['SERVER_NAME'], 0, 3); //Is visitor coming in on "www?"
if ($isWWW == www)
{
$preURL = "www.";
}
else
{
$preURL = "";
}
?>
Then to create the actual link, just modify your Juicebox settings like this:
configUrl: "http://<?=$preURL?>mysite.com/path/to/config.php?var1=<?=$var1?>&var2=<?=$var2?>"
This worked for me, but I'd love to see a real coder's hand on this.