I am having trouble installing Quizzy on my server. It only displays the first question and the results, but if I install it on a different server, it works. Do you know what may be causing this? What options should be enabled in php.ini ?
Is there any chance you could give me a url for the page on the server where it doesn't work?
quizzy 1 only requires php 5 for its simplexml… which I believe is enabled by default.
There are supposed to be 3 questions. I think we are running PHP 5, because I am using simplexml for another project.
Hmm.. Can i see your quiz.xml file for this quiz?
any chance you could make a file called test.php that just contains <?php phpinfo(); ?> and give me a url to it?
I'd like to see the particulars of your school's php installation
Sure thing! http://www.purdue.edu/vic/my_phpinfo.php Apparently, I don't have permissions?
Well I just tried your xml file in my local setup of quizzy 1 and it works just fine but I'm running the pre-1.0 git version.
To make sure this isn't a quizzy problem, try upgrading your quizzy install to the version here. Just backup all your quizzy config files (quizzyConfig.js quizzyConfig.php and quizzySkin.css) untar the archive in your quizzy folder overwriting any files that are different and try it again.
Let me know if that fixes the issue.
Hmmm…I still seem to get errors (plus the quiz will not load at all now). http://author.www.purdue.edu/vic/access/quiz.php
Also, I was able to obtain my PHP configuration and I put it in a PDF. http://author.www.purdue.edu/vic/phpinfo.pdf
This sure is weird. Can you show me what you have in your quizzyConfig.php file?
quiz.php is in the root folder with a quizzy folder that contains all the quizzy stuf right?
Yes, quiz.php is located just outside of the quizzy directory. Here is my quizzyConfig.php file:
//where the quiz xml files are stored under the /quizzy directory
//default is /quizzy/quizzes so by default the variable is set to 'quizzes'
$quizFolder = 'quizzes';
//where the quiz picture files are stored under /quizzy/$quizFolder
//by default, it looks in the same folder as the quizzes. this might get
//messy with a large number of quizzes so the option to move it out is given here
$picFolder = '.';
//the dimensions of the quiz in pixels
$quizWidth = 500;
$quizHeight = 300;
//The message to display above the list of quiz names that the user would select
//this is put in an h1 tag
$pickQuizMessage = 'Please Select a Quiz';
//The message displayed at the end of the quiz before the user's score, grade, and rank
//this is put in an h1 tag
$endQuizMessage = 'Done!';
Okay, I think I'm getting close here.
Try changing the line
$cwd = str_replace('\\', '/', getcwd());
in quizzyConfig.php to
$cwd = str_replace('\\', '/', dirname ( realpath (__FILE__) ) );
Ok. I changed it and received some warnings this time.
Sorry about the late reply for this.
Could you just zip up your whole quizzy directory (including quizzes and lib) send it to me so I can take a look at it? That way I could run it on my local server and actually see all the PHP warning output and all that.
Sorry you're having so much trouble with this…
Sure. http://web.ics.purdue.edu/~schenkk/quizzy.zip The quizzy zipped folder contains quiz.php (which was originally located outside of the quizzy directory).
My guess is that this is a problem with my PHP server configuration?
sorry about the delay.
I looked at your install and those warnings were coming up on the select quiz page because of all the files in your quizzes directory that weren't actually quiz xml files. Remove the LCK file and those warnings go away.
After I did that, the quiz worked showing me all 3 questions. So try removing that LCK file and see if you get all three questions. If you don't then we're looking at a bug in PHP specific to your version that I'll have to add a work-around for.
Also, in case your curious, those warnings were coming up because quizzy was trying to parse that LCK file as though it were a quiz xml file since it has the string ".xml" in its title. I added a bug to trac to change that behavior to looking for files with ".xml" on the end of the filename
Sorry for the long response. I removed all ".LCK" files. Apparently, it is a Dreamweaver lock file that stores file check out information FYI. I was able to get rid of the errors, but the quiz still only displayed 1 question. Thank you so much for you help. I would really like to utilize this nice tool. I know that in the past, I have had troubles with fopen() since our current configuration blocks it. Any other ideas? Or debugging code that I could upload for you?
hmm I'll keep looking in to it. You said you were able to use simplexml in a previous project didn't you? I think that if fopen were the culprit, it wouldn't even load the list of quizzes. I'm going to look into the angle that maybe your version of php has a bug in simplexml or I'm using simplexml kind of wrong (by using the count() function to determine how many questions there are).
Yes, I am using simpleXML for another project, and it works. Thanks for your help!
Ok, I got something for you to try. Try changing line 29 of serveQuestion.php from
if($questNo >= count($quiz->question))
if($questNo >= count($quiz->xpath('//question')))
See link from post #14. You're getting close! It shows the questions, but not the final results. So close! Thanks for helping!
I figured that count() function was the problem. Sorry this took so long, but without direct access to your setup, it was pretty tricky to debug. I think things might be fixed for you if you change line 21 in serveQuiz.php from
$numQuestions = count($quiz->question);
$numQuestions = count($quiz->xpath('//question'));
I'm pretty sure that's it. That was the other place that count($quiz->question) was being used to get the number of questions in the quiz but doesn't work. It apparently always returns 1. Changing that line to $numQuestions = 1; in my setup reproduces your current problems.
Let me know if that worked.
Added this as an issue to the bug tracker so the fix will be added to future releases (including quizzy 2.0)
Awesome! It works! Thank you so much!