If I'm understanding correctly, you could put the JavaScript internally in the web page and echo the PHP into it - very simply;
Code:
<html>
<head>
<script>
... script stuff ...
<?php // Build fadepic array
$x=0;
foreach (glob("../main_page_images/*.*") as $filename) {
$filename = substr($filename, 20);
echo "fadeimages[".$x."]=[\"main_page_images/".$filename."\", \"\", \"\"]<br>";
$x++; ?>
... more script stuff ...
</script>
</head>
<body>
... HTML stuff ...
</body>
</html>
This will only work with the JavaScript located directly into the web page. It wouldn't work if the JavaScript is in an external file (js client-side / php server-side differences).
If you need more help, please provide a link to the script demo page here on DD and also a link to your page.
Bookmarks