Summary: quiz implementation(Leitner-system)
Version: 2005-04-05
Prerequisites: none
Status: Cookbook has to be updated, last tested with PmWiki version: 2.0.beta28
Maintainer: KAL
Categories: Uncategorized (any idea ?)


How to implement a quiz with pmwiki ?


Thanks to the if-markup? the implementation is rather simple:

  • add another if-condition using the following code in config.php:
  # (:if answer:) page is called with parameter answer=1
  # (:if ! answer:) page is called without parameter answer or with answer!=1
  $Conditions['answer'] = '$_REQUEST["answer"]==1';
  • create a group containing all quiz-pages
  • create page-groupfooter containing a link to hide / show the answer on each quiz-page:
(:if ! answer:)
|| <[[{$FullName}?answer=1|show answer]]> ||
(:if answer:)
|| <[[{$FullName}|hide answer]]> ||
  • create a bunch of quiz-pages with the format:
!This is the question

(:if answer:)
And this is the answer
! my Quiz
* Question 1
* Question 2
* Question 3


Its just a quick and easy implementation. Using the WikiTrails-feature will let you guide you through all the questions and answers of the quiz (i.e. of the group).

Starting from the indexpage the question of the first quiz page is displayed with a link to display the same page with the question and the corresponding answer (which is contained on the same page hidden by the if-markup).

The answer is displayed when the page is called using an additional parameter ?answer=1 appended to the pages's URL.

After displaying the answer you can use the wikitrail at the page's top to jump to the next question.

possible improvements:

  • add a function to count the user's right / wrong answers (adding two buttons: "was ok" / "was not ok")
  • result could be recorded and displayed on the end of the quiz
  • if the user logs on with a user-id, the results could be recorded permanently
  • change the WikiTrail according to the results of the previous quizes
    (like learning using the Leitner-system,
    see: http://bibelkunde.uni-muenster.de/karteikarten.html (german)
    or http://www.flashcardexchange.com/leitner.php (english))

Notes and Comments

  • This recipe was last tested on PmWiki version: 2.0.beta28

Thanks for the recipe. I'm doing my page footer a little different:

(:if ! answer:)
|| <[[{$FullName}?answer=1|show answer]]> ||
(:if answer:)
|| <[[{$FullName}|hide answer]]> ||


then inside the page text I can put the answer in (:answer:This is the answer.:) -- less typing in the page, and it allows the Hide/Show links to be above the answer text. It would be nice to get this type of responsiveness with CSS/Javascript show/hide as well...I'm sure that's possible too from another recipe. Thanks! XES April 22, 2008, at 11:59 AM

See Also


KAL - first implementation

Category: Cookbook

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.