passing a variable through 2 required files embedded in Javascript

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What a mess this has turned out to be -- But perhaps you can help me.

I have a dynamic site that pulls headers, navigation, and footers from text files.  The content for the pages is pulled from mySQL.

On each page I have a JavaScript rotating banner that displays "Upcoming Events."  The banners rotate about every 4 seconds without the need for a page refresh.  The names of the individual banners themselves are fed into JavaScript from a PHP script that reads a folder of JPG files and makes a decision as to which ones to show (i.e. pass to the JavaScript).

This all works and it's slick seeing that I have the difficulty of dealing with a server side script and a client script.  The browser calls a JavaScript file which has a php extension.  When the server "sees" the php extension the file is executed before it is delivered to the browser.  Since JavaScript complains about PHP functions in that file that file merely echo back standard JavaScript and calls another php file via require() that does the low level work of reading the folder and reporting back the JavaScript arrays.  Graphically it looks like this:

1) the Page calls the header
     2) the header calls 
           3) a php generated JavaScript file which calls
                    4) a php file that reads the folder on the server and builds the JavaScript arrays


Now I need to add a feature and I am bumping my head on this one.  

How do I report the file name of the file that called the header in # 4 ?  In other words, I want the name of #1 to be reported in #4.  If I use $_SERVER["PHP_SELF"], that variable reports the name of #4.  It gets a little tricky because #3 is called from within a JavaScript tag.

Got any suggestions?

Mark Cain

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux