I know you can insert normal HTML codes right into a passage in... pretty much any Twine 2 formats, yes? Is it possible to insert PHP code as well? I gave it a test go and the ?php part of the code got parsed out as something(?) so it didn't process right; I'm wondering if that's because it doesn't support the syntax or if I'm missing some sort of escape code.
(I did a bunch of searches and didn't find anyone asking about this, apologies if I missed it.)
Comments
But maybe someone else knows of a solution to client-side processing of embedded PHP elements.
I've been looking at the resulting test page and the twine file and I suddenly to my chagrin recalled that ?text is a hook reference. So it's parsing the text as a hook reference when it generates the html file. Gah!
I suppose it's possible to get the php to generate properly on initial load, if one could find a way to mark the ?php as not-Harlowe-code without ALSO marking it as not-HTML as `escaping` does. Which I think is probably never going to happen.
Balderdash. Back to the drawing board. Thanks anyway, greyelf!
Put another way:
If the story HTML file is served from a web server that has PHP enabled (and configured to process the story HTML file) then the php related elements will be executed before the embedded Javascript engine starts up. This means that by the time the engine processes the Passage that contained the php elements those elements will no longer exist.
Did you find a way to include php in Harlowe? I would be very much interested in your findings, as I am looking for a way to enable visitors to rate paragraphs (using a php-based counter).
This would, of course, require editing passage text without returns, due to AJAX's asynchronous nature. Additionally, the PHP files would have to be separate from the story text.