• Hey,

    I’ve been wondering if it’s possible to display a fixed number of questions per page. Let’s say I have a quiz with 100 questions and i’d like to display 25 questions at a time. I’d like the user to answer all the question, only that he’d be given the first 25 question first, and the next 25 question when he’d click next and so on until he went through all 4 pages of 25 questions.

    Thanks in advance.

    http://wordpress.org/extend/plugins/wp-pro-quiz/

Viewing 5 replies - 1 through 5 (of 5 total)
  • I’d be really interested in this, as well!

    +1 for this.

    Thread Starter anzes

    (@anzes)

    I’ve actully managed to solve the problem. It’s probably a horrible way to do it as I’m quite new to programming, but it works, and so far I’ve had no problems with it. I hope U’ll find it helpful.
    First, U’ll want to open your plugins folder, go to wp-pro-quiz, lib, view and open the WpProQuiz_View_FrontQuiz.php file.

    U’ll have to find the start button – just search the file for Start quiz string.
    U’ll want to add onclick event:
    onclick="$('ol.wpProQuiz_list li').hide().slice(0, 245).show(); $('ol.wpProQuiz_list div').hide().slice(0, 263).show(); $( '#level2' ).show();$( '#finish' ).hide();"
    What this does is basically hide the whole list of answers and question and then shows first 245 items – in my case that was the first 25 questions, your numbers will probably vary and U’ll probably have to give it a couple of tries to catch the right number. The same goes for number of Div’s u’d like to show – I’ve been using some divs in questions and answers – if you don’t, your number will probably be a lot lower. As for the end of the code, we’ll hide the finish quiz button and show the level 2 button – the button that will display questions on level 2.
    Further on, just below the Finish test button in the same file, I’ve added

    <div style"margin-top:200px;"  style="display:none;" class="button" id="level2" onclick="$('ol.wpProQuiz_list li').slice(0, 515).show(); $('ol.wpProQuiz_list div').slice(0, 529).show();$( '#level3' ).show();$( '#level2' ).hide();">Continue to level 2</div>
                				   				  <div style"margin-top:200px;"  style="display:none;" id="level3" class="button" onclick="$('ol.wpProQuiz_list li').slice(0, 788).show(); $('ol.wpProQuiz_list div').slice(0, 805).show();$( '#level4' ).show();$( '#level3' ).hide();">Continue to level 3</div>
                           				   				  <div style"margin-top:200px;"  style="display:none;" id="level4" class="button" onclick="$('ol.wpProQuiz_list li').slice(0, 1400).show(); $('ol.wpProQuiz_list div').slice(0, 1400).show();$( '#finish' ).show();$( '#level4' ).hide();">Continue to level 4</div>

    This adds three aditional buttons – the one to go to level 2, level 3 and level 4 – I havent hidden the questions from previous level so the user can still check them if they’d like. The principle is the same – find the number of list items and divs you’d like to show for each category/level. We’re also hiding/showing the buttons accordingly.

    That’s about it. Not an elegant solution at all, but a working one :). You can see a working example at
    http://www.delavec.si/sterling/english-test/?lang=en

    Hope this helps, for as long as functionality like this is not added to the plugin itself.

    Cheers

    That’s great, but personally I’m after more of a true pagination. As in…

    Question 1 -> page reload -> question 2 -> page reload -> question 3

    Etc. There are elements outside of the form I’d like to refresh in between questions.

    Plugin Author xeno010

    (@xeno010)

    This comes in version 0.27

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Pagination’ is closed to new replies.