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

Help with relative paths

Help
Dowgirl
2011-07-03
2013-05-28
  • Dowgirl
    Dowgirl
    2011-07-03

    Hello - I am having trouble implementing this is an application (Wordpress, yeah, I know) where there is redirection by the application to simplify the URLs.

    I have no problem to create a page on the server with a quiz, browse to the page through the absolute path and run the quiz. It's sweet - But when I put the include commands on a Wordpress template, the quizzy files seem to be not found because all I get is a blank space and in the source code I can see the quizzy and quizzy load divs, but they are empty and, by the way, not the correct sizes dimensions.

    I then changed the calls to the script in the header files to a more complete path
    wp-content/themes/themename/quizzy/quizzy.php';

    When I do that, I get mostly what I want - but I cannot seem to figure out how to set the images folder and I also am puzzled by the PATH which is printed out at the top of the quiz,.

    http://www.bigshakti.com/chakras/testing

    I'm SO close to getting this working - I'd love to figure this out completely.

     
  • Joe B.
    Joe B.
    2011-07-04

    What version of quizzy are you using?
    I think I improved the path stuff a whole bunch with quizzy 2.0 beta 1 which is now available in the downloads sections.

    Looking at your testing page, it looks like it's not including the quizzy JavaScript files either.
    Sorry I'm not too familiar with Word Press but I'd be happy to help you all I can.

     
  • Dowgirl
    Dowgirl
    2011-07-05

    Hi - Dowgirl here again, in case someone else finds their way to this page. I was able to use an iframe to include the quiz in a Wordpress sidebar included file - I just put the quiz on a stand alone php page, not on a Wordpress template page. Then that is the page I included with an iframe. Works great this way.

     
  • Joe B.
    Joe B.
    2011-07-05

    I'm glad you figured it out. Thanks for putting your solution here.

     
  • Dowgirl
    Dowgirl
    2011-07-06

    Hi - I had to remove the files from that site - but I really like it so I will be putting it on other sites -- including other Wordpress sites. I'll keep you posted on the file location issue. I am using the latest 2.0 files.

     
  • Karagiosis
    Karagiosis
    2011-07-23

    For those having problems with relative paths, here are a few tricks. These are for Quizzy 2 beta 1 with an install on localhost/your_site:
    1. Make sure that your main file (the one including Quizzy's php files) has ".php" extension (not html)
    2. Put this in your (X)HTML header: <base href="http://localhost/your_site/" / >
    3. If Quizzy displays, but no Quizz is listed, comment out lines 268 and 269 in quizzy/quizzy.php :
    //if (!preg_match("/.xml$/i", $file))
          //  continue;
    as they prevent the example quizz "quizzes/tour.xml.example" to be listed.
    Then, you should be able to run the demo quizz.

    After this are still several with version 2 beta 1.
    - The demo quizz only shows radio buttons instead of checkboxes and all radios are flagged with the "correct answer" character after you click some radio button. This is paradoxal.
    - The images are not found (at least on a localhost).

     
  • Joe B.
    Joe B.
    2011-11-05

    Thanks karagiosis for your tips. Just so people know about #3 above, that preg_match is to prevent non-xml files from showing up in the quiz list and (possibly) making something bad happen. The editor I use likes to make backup files called whatever.xml~ that are essentially the same as whatever.xml but just the last version. Without that preg_match there, I was seeing the same quiz listed twice in the quiz selection screen if I didn't remove that backup file.

    I'd recommend just renaming quizzes/tour.xml.example to quizzes/tour.xml to enable the tour quiz, that way if you accidentally toss something else in that folder, it won't cause issues down the line.