We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I can embed a sketch in a html page, but when I try to embed the same sketch in a php page, it doesn't work. I have other php pages running fine on my laptop. Is processing.js incompatible with php? Or am I missing something really obvious?
Any help appreciated.
d.
Here's the code for processingTest.php
<body>
<canvas data-processing-sources="processing/flowmatic_600.pde" width="600px" height="400px"></canvas>
</body>
Answers
Got no idea. But as a workaround, how about transpile sketches to JS? ;;)
http://processingjs.org/tools/processing-helper.html
Bit rusty on PHP but...
In this situation you are using PHP to generate the HTML code. Anything NOT between
<?php
and?>
tags will be echoed back to the client soThe alternative is to use the
echo
statement orprint
functions to return the actual HTML statements from inside the php blocks.Thanks for your help. I did a bit more digging in the browser and it turns out that I was getting the following error,
"Unable to load pjs sketch files: myFileName.pde ==> Invalid XHR status 404" message in browser
which this forum thread helped me to fix.
http://forum.processing.org/one/topic/unable-to-load-pjs-sketch-files-lifetime-web-pde-invalid-xhr-status-404-message-in-browser.html
I'm using IIS (on windows) and it turns out that it was (helpfully!) filtering out the .pde file type. When I added it as an acceptable extension, everything worked fine.