How do you embed a Mathematica CDF in a Tikiwiki blog post?
I'm trying to post a Mathematica CDF to my Tikiwiki 12 blog but can't get it to work quite right. I created a CDF to demonstrate the Fermi-Dirac function. The fermidistribution.cdf file was uploaded to the file gallery with fileID=55. The femidistibustion.png was uploaded to the file gallery with fileID=56. The files can be retrieved in several ways as far as I can tell. The dlxx means download the file with fileID=xx. The displayxx means display file with fileID=xx. The files are loaded into the MySQL database instead of being stored in a directory.
I tried the two syntax options based on what the “From Desktop to Web: Deploying Ideas with CDF” video indicated. The first option uses the download syntax and the second option uses the display option. I call the html file using the Tikiwiki {IFRAME()} command in the blog posting. The {IFRAME()} command was used in the following forms and the resulting actions are indicated as well:
1. {IFRAME(width="596" height="614" scrolling="no" src=https://www.p-brane.com/nano/display64)}{IFRAME} ⇒Yields a blank frame
2. {IFRAME(height=596,width=614, scrolling=auto)}tiki-print.php?field=64{IFRAME} ⇒ Yields the home page with an error message
3. {IFRAME(width="596" height="614" scrolling="no")}tiki-download_file.php?fileID=63{IFRAME} ⇒ Yields a download box. If you open the file in the browser then the cdf plays and functions as expected.
4. {IFRAMEx(width="596" height="614" scrolling="no" src=https://www.p-brane.com/nano/dl64)}{IFRAME} ⇒ Yields a download box (same as 3). If you open the file in the browser then the cdf plays and functions as expected.
What is the proper syntax to use so that the cdf runs without having to open a file to an new browser window or tab (using IFRAME or something else)? I could not get my html code to display correctly so to keep the script command form being delete I called it xscript.
Option one has fileID=64
<html> <body> <script type="text/javascript" src="http://www.wolfram.com/cdf-player/plugin/v2.1/cdfplugin.js"></script> <script type="text/javascript"> var cdf = new cdfplugin(); cdf.setDefaultContent('<a href="http://www.wolfram.com/cdf-player/"><img src="https://www.p-brane.com/nano/dl56"></a>'); cdf.embed('https://www.p-brane.com/nano/dl55', 596, 614); </script> </body> </html>
Option two has fileID=63
<html> <body> <script type="text/javascript" src="http://www.wolfram.com/cdf-player/plugin/v2.1/cdfplugin.js"></script> <script type="text/javascript"> var cdf = new cdfplugin(); cdf.setDefaultContent('<a href="http://www.wolfram.com/cdf-player/"><img src="https://www.p-brane.com/nano/display56"></a>'); cdf.embed('https://www.p-brane.com/nano/display55', 596, 614); </script> </body> </html>
Update 2/23/14
Mathematica technical support provided this sample HTML code for embedding a CDF into a web page. This code, however, does not produce a working CDF in a Tiki Blog.
<!DOCTYPE html> <html> <p>This is a template for CDF examples</p> <body> <script type="text/javascript" src="http://www.wolfram.com/cdf-player/plugin/v2.1/cdfplugin.js"></script> <script type="text/javascript"> var cdf = new cdfplugin(); cdf.setDefaultContent('<a href="http://www.wolfram.com/cdf-player/"><img src="Case628259-FermiDistribution.png"></a>'); cdf.embed('Case628259-FermiDistribution.cdf', 710, 710); </script> </body> </html>
I also tried this with a HTML iframe but it did not work either. The Tikiwiki editor also likes to throw in some in the script and iframe commands.
{HTML(wiki="0")}<!DOCTYPE html> <html> <p>This is a template for CDF examples</p> <iframe width="596" height="614"> <body> <script type="text/javascript" src="http://www.wolfram.com/cdf-player/plugin/v2.1/cdfplugin.js"></script> <script type="text/javascript"> var cdf = new cdfplugin(); cdf.setDefaultContent('<a href="http://www.wolfram.com/cdf-player/"><img src="https://www.p-brane.com/nano/dl56"></a>'); cdf.embed('https://www.p-brane.com/nano/dl55', 710, 710); </script> </body> </iframe> </html>{HTML}
Update 2/24/14
I discovered that the following code works in IE but not in Firefox or Chrome:
This code runs fine in IE.
{IFRAME(width="710" height="710" scrolling="no" src=https://www.p-brane.com/nano/display63)} {IFRAME}
where display63 contains
<html> <body> <script type="text/javascript" src="http://www.wolfram.com/cdf-player/plugin/v2.1/cdfplugin.js"></script> <script type="text/javascript"> var cdf = new cdfplugin(); cdf.setDefaultContent('<a href="http://www.wolfram.com/cdf-player/"><img src="https://www.p-brane.com/nano/display56"></a>'); cdf.embed('https://www.p-brane.com/nano/display55', 596, 614); </script> </body> </html>