Calling a variable from another page

I know just enough PHP to get myself into heaps of trouble. I’m hopeful someone can steer me right on this one.

I have a website where every page has an XML driven slideshow in the header. Each page has a variable that points the slideshow XML to a specific gallery of photos to show. Right now, I have several XML files hardcoded to point to each individual gallery, but I want to just have one XML file that dynamically points to the different galleries. I found a dynamic PHP script that generates an XML file (http://www.developphp.com/view_lesson.php?v=311) and I have it working as long as it is pointing to a specific image gallery. I need to have the XML variable on the webpage brought into the XML file so that it can point to whatever gallery the webpage variable is set to. Am I making sense? Am I giving enough info?

Please, any help would be much appreciated. Thx.

Here is some code to shed more light…

Index page:

<?php $pageXML="default"; include('header.php'); ?>

Content content content

<?php include('footer.php'); ?>

Flash include in header.php: This is what I want it to be. Right now, I have the Flash include calling a hard-coded XML (images/slideshow.swf?file=slideshow-<?php echo $pageXML ?>.xml)

Slideshow.php that generates the XML: Look at $dir. That’s where I need to get the pageXML variable from each page into.

<?php // PHP file that renders perfect Dynamic XML for any image applications // Script written by Adam Khoury @ www.developphp.com - April 05, 2010 // View the video that is tied to this script for maximum understanding // ------------------------------------------------------------------- header("Content-Type: text/xml"); //set the content type to xml // Initialize the xmlOutput variable $xmlBody = '<?xml version="1.0" encoding="UTF-8"?>';

$dir = “images/beforeafter/$pageXML/”; // Specify Directory where images are
$xmlBody .= “”; // Start XMLBody output
// open specified directory using opendir() the function
$dirHandle = opendir($dir);
while ($file = readdir($dirHandle)) {
// if file is not a folder and if file name contains the string .jpg
if(!is_dir($file) && strpos($file, ‘.jpg’)){
$xmlBody .= ‘’;
} // close the if statement
} // End while loop
closedir($dirHandle); // close the open directory
$xmlBody .= “”;
echo $xmlBody; // output the gallery data as XML file for flash
?>

Anyone?

Please…anyone

I’m still looking for this solution…
anyone?

Sponsor our Newsletter | Privacy Policy | Terms of Service