Topic: Reading config.php from external website

Hi there. I am using Juicebox on our new website(s) since some months.  I used the config.php file (see below) to generate dynamic slideshows. On my first site it works all right and on my second site too, as long as all content is located on the same server. In this situation, whenever I have to upload new content , I have to upload it to both servers. So, I tried to make the embedded code on (one page of) my second website point to the juicebox folder on my first website but then the page on which the slideshow should show, says: "Juicebox Error: Config XML file not found." Can you please help me? What am I doing wrong here?


Embed code on first website (http://www.hendriksschoenmode.nl/yaktrax.htm):

<!--START JUICEBOX EMBED-->
<script src="juicebox/Yaktrax/jbcore/juicebox.js"></script>
<script>
new juicebox({
baseUrl : 'juicebox/Yaktrax/',
configUrl : 'config.php',
containerId: "juicebox-container",
etc.

Embed code on second website (http://www.hendriksschoenmode.com/yaktrax.htm):

<!--START JUICEBOX EMBED-->
<script src="http://www.hendriksschoenmode.nl/juicebox/Yaktrax/jbcore/juicebox.js"></script>
<script>
new juicebox({
baseUrl : 'http://www.hendriksschoenmode.nl/juicebox/Yaktrax/',
configUrl : 'http://www.hendriksschoenmode.nl/juiceb … config.php',
containerId: "juicebox-container",
etc.

CONFIG.PHP looks like this:
<?php
header("Content-type: application/xml");
function GetDirArray($folder)
{
    $handle=opendir($folder);
    while ($file=readdir($handle))
    {
        if ($file!="." && $file!="..")
        {
            $ret[count($ret)]=$file;
        }
    }
    closedir($handle);
    sort($ret);
    return $ret;
}
$gallery=GetDirArray('images');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<juiceboxgallery title="Juicebox Gallery">';
for ($i=0; $i<sizeof($gallery); $i++)
{
    echo '<image imageURL="images/'.$gallery[$i].'" thumbURL="images/'.$gallery[$i].'" linkURL="" linkTarget="">';
    echo '<title></title>';
    echo '<caption></caption>';
    echo '</image>';
}
echo '</juiceboxgallery>';
?>

Re: Reading config.php from external website

All Juicebox gallery files should be on the same domain (or subdomain) as the web page which contains the gallery's JavaScript embedding code due to the same-origin policy.
Please see here for details: https://developer.mozilla.org/en-US/doc … gin_policy

In order to use files on a different domain, you could implement a Cross-Origin Resource Sharing (CORS) solution. More information about CORS can be found here: http://www.w3.org/TR/cors/

If you have an Apache server, add the following line of code to the .htaccess file in the root directory of the domain which hosts the gallery folder.

Header add Access-Control-Allow-Origin "*"

If you have an IIS server, then please see this link for a similar solution: http://enable-cors.org/server_iis7.html