With the cooperation of Derek, we managed to find an interstitial code segment from Dynamic Drive (www.dynamicdrive.com). We had some issues getting it implemented (mostly due to my stupidity with a spelling error in the location of the referrer…)
The interstitial runs from a fairly complex Javascript file that we’re including based on a document referrer that checks whether the previous page is the ‘addDrink.php’ page. We did this using the following PHP script segment:
<?php
if($_SERVER["HTTP_REFERER"]== "http://lab.derekfernholz.com/SCABMS/test/addDrink.php"){
echo '<script type="text/javascript" src="interstitialOn.js" charset="UTF-8"></script>';
}
?>
The Javascript file uses an array of statements to control what pages are displayed, the frequency of the display, the formatting of the header on the interstitial, cookie settings, bust caching pages fetched by Ajax, whether the scrollbars are disabled or not, and a timer for an auto hide on the interstitial. The code in the JS file looks like:
var interstitialBox={
//1) list of files on server to randomly pick from and display
displayfiles: ['samplecontent.htm', 'samplecontent2.htm'],
//2) display freqency: ["frequency_type", "frequency_value"]
displayfrequency: ["chance", "1"],
//3) HTML for the header bar portion of the interstitial box
defineheader: '<div class="headerbar"><a href="#" onClick="javascript:interstitialBox.closeit(); return false"><img src="closeit.gif" style="border: 0" title="Close Box"/></a></div>',
//4) cookie setting: ["cookie_name", "cookie_path"]
cookiesetting: ["stitialcookie", "path=/"],
//5) bust caching of pages fetched via Ajax?
ajaxbustcache: true,
//6) Disable browser scrollbars while interstitial is shown (Only applicable in IE7/Firefox/Opera8+. IE6 will just auto scroll page to top)?
disablescrollbars: true,
//7) Auto hide Interstitial Box after x seconds (0 for no)?
autohidetimer: 0,
Now, we just need to get a page made up for displayfiles[] that is going to show the different glasses that are selectable for the drink. It will also allow the user to input a default glass along with the other available sizes. The difficulty is going to be getting the items (the selected glass sizes) from the interstitial to the configuration page so that they can be sent to the database along with the rest of the drink information.
As for the SQL query to get the drinks added into the database…that’s yet to come.