In fact how would I call the percentage value in show_quiz.php ?
Something like <?php echo “percentage”;?>
As I could put the text area in show_quiz.php.
There has been a request for a social sharing of scores type feature as well as emailed and database stored results. Of those listed, emailing results will likely be the first implemented (as early as the next couple weeks!).
The percentage is calculated by the JavaScript. The percent isn’t known by any php action since the quiz hasn’t been taken yet. Once the quiz is loaded on the page, the JavaScript does everything else. In the final screen, every instance of the variable %%PERCENTAGE%% is replaced with the percent. The JavaScript function mtq_results_message searches the text string located in the html element named #mtq_quiz_results-NumberOfQuiz. If you wanted to have it replace the variable in another location, this would be the function to edit. Be aware there are two JavaScript files script.js and script.min.js and the minimized one is loaded by default. You can either edit the min one or change the script enqueue in mtouchquiz.php to load the other one.
I do have a few improvements planned, and I appreciate your support and kind words. The main thing to realize is that I am not a professional developer and this isn’t my “day job.” I wrote this plugin for use on my own personal projects but released it to the public since it seemed useful for others as well.
Good luck. I’d love it if you dropped me a line or posted a link back here showing what you did. Everyone benefits when everyone shares.
Best wishes,
Michael