Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Problem with Quizzy

Help
2011-02-02
2013-05-28
  • Kevin Schenk
    Kevin Schenk
    2011-02-02

    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 ?

     
  • Joe B.
    Joe B.
    2011-02-02

    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.

     
  • Kevin Schenk
    Kevin Schenk
    2011-02-02

    http://author.www.purdue.edu/vic/access/quiz.php

    There are supposed to be 3 questions.  I think we are running PHP 5, because I am using simplexml for another project.

     
  • Joe B.
    Joe B.
    2011-02-03

    Hmm.. Can i see your quiz.xml file for this quiz?

     
  • Kevin Schenk
    Kevin Schenk
    2011-02-03

    <quizzes> <quiz> Brain Buster - Vol. 1 <description> For week of January 31 </description> <grading> <range start="0" end="60"> <grade>F</grade> <rank>Failure</rank> </range> <range start="61" end="69"> <grade>D</grade> <rank>Ehh. Try again.</rank> </range> <range start="70" end="79"> <grade>C</grade> <rank>You're Average.</rank> </range> <range start="80" end="89"> <grade>B</grade> <rank>Good job.</rank> </range> <range start="90" end="100"> <grade>A</grade> <rank>Excellent. Master ambassador!</rank> </range> </grading> <question> What is the name of the new building that will be home to the Hospitality and Tourism Management Department? How much was donated? </question> <question> The test me with this question... The answer is not A or C. </question> <question> blank </question> </quiz> </quizzes>
     
  • Joe B.
    Joe B.
    2011-02-03

    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

     
  • Joe B.
    Joe B.
    2011-02-03

    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.

     
  • Joe B.
    Joe B.
    2011-02-11

    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?

     
  • Kevin Schenk
    Kevin Schenk
    2011-02-11

    Yes, quiz.php is located just outside of the quizzy directory.  Here is my quizzyConfig.php file:

    <?php
      //global variables
       
      //PLEASE NOTE:
      //There are several other JavaScript-only options configurable in the quizzyConfig.js 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!';
    ?>
    
     
  • Joe B.
    Joe B.
    2011-02-12

    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__) ) );
    
     
  • Kevin Schenk
    Kevin Schenk
    2011-02-12

    Ok.  I changed it and received some warnings this time.

     
  • Joe B.
    Joe B.
    2011-02-17

    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…

     
  • Kevin Schenk
    Kevin Schenk
    2011-02-18

    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?

     
  • Joe B.
    Joe B.
    2011-02-21

    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

     
  • Kevin Schenk
    Kevin Schenk
    2011-02-28

    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?

     
  • Joe B.
    Joe B.
    2011-03-01

    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).

     
  • Kevin Schenk
    Kevin Schenk
    2011-03-01

    Yes, I am using simpleXML for another project, and it works.  Thanks for your help!

     
  • Joe B.
    Joe B.
    2011-03-07

    Ok, I got something for you to try. Try changing line 29 of serveQuestion.php from

    if($questNo >= count($quiz->question))
    

    to

    if($questNo >= count($quiz->xpath('//question')))
    
     
  • Kevin Schenk
    Kevin Schenk
    2011-03-08

    See link from post #14.  You're getting close!  It shows the questions, but not the final results.  So close!  Thanks for helping!

     
  • Joe B.
    Joe B.
    2011-03-08

    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);
    

    to

    $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.

     
  • Joe B.
    Joe B.
    2011-03-08

    Added this as an issue to the bug tracker so the fix will be added to future releases (including quizzy 2.0)

     
  • Kevin Schenk
    Kevin Schenk
    2011-03-08

    Awesome!   It works!  Thank you so much!