PHP and StoryLine.
Oct 15, 2015
Hi,
I recently started working with StoryLine as part of my job as a developer. There was a need for 'storage' of some user input variables which would be loaded/saved/edited throughout various courses. For a couple of days I investigated passing variables to and from StoryLine and saving them via various methods including WebStorage and at one point using PHP on a pop out window to save them in session storage and then retrieve them via JS in SL (though this is where the limitation occurred as although I can iterate through webstorage to check the number of key/value pairs - you cannot dynamically create variables in StoryLine).
I thought there would be a much easier way to achieve this and I found it.
There is a method to embed php directly in to your storyline slides. All it takes is a simple 'dummy' HTML file with a redirect to a PHP page. Since the WebObject loads in an iFrame, there is no limit/error in this method.
I create a file named 'index.html' in a folder and in this same folder I place my php file. When the webObject loads in StoryLine it redirects to the 'login.php' file. This also allows you to insert the WebObject in to a StoryLine slide as a 'marker' for where the PHP will load/show results.
Hope this helps someone. I have checked on the discussion groups and haven't found anything related, so sorry if this topic has been covered previously.
Thanks,
Kris
-----------------------
Here is the PHP page showing in storyline :
Here is the simple redirect script :
<!DOCTYPE HTML>
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="1;url=login.php">
<script type="text/javascript">
window.location.href = "login.php"
</script>
<title>Page Redirection</title>
</head>
<body>
If you are not redirected automatically, follow the <a href='login.php'>link</a>
</body>
</html
11 Replies
Hi, Kris! Welcome to the community and thanks so much for sharing your discovery! Tips and tricks are always appreciated. :)
Fantastic tip Kris! This is the kind of information that takes Storyline so much further than it's fundamental tools. Thank you for sharing. I don't have a need now but see plenty of ways this could be used in future projects.
Thanks Christie :) No probs at all.
You are welcome Michael, it was a simple solution to a complex issue. The box with the blue outline you can see in the image is a storyline shape, then there is a webobject on top of it, which is where the PHP redirect is. I have a PHP login system which then allows users to add/update/delete words from their 'bank'. :) If you have any questions when you get to using it, give me a shout :)
Just to add - when you publish your project, you need to manually move the php files associated with your webObject in to the folder since StoryLine doesn't pick them up for inclusioin :)
Thanks for the update Kris :)
Thank you Kris for this redirect script.
It will help me to continue my works.
Glad that this older thread was able to assist you here Denis :)
Glad to be of help Denis :)
Thanks a million , Kris! this is what i came searching for today,
Glad to see that this was able to assist you as well :)
This discussion is closed. You can start a new discussion or contact Articulate Support.