[pmwiki-users] Including a php script

Petko Yotov 5ko at 5ko.fr
Mon Nov 27 01:37:25 PST 2023


On 26/11/2023 19:23, Gregor Klarič wrote:
> I have a quiz which I would like to display within a wiki page, to
> have the same look and feel
> 
> This is the page
> https://www.gobe.si/kviz/
> 
> How can I include this, I guess as a markup, but somehow I fail to
> find a description on how to do it when I have an interaction with the
> page.

I use this kind of interactions a lot: markup directives that output 
different content based on user choices.

I also write forms in PmWiki markup which is much easier than raw HTML, 
for example

   (:input radio name value1 "Label 1":)\\
   (:input radio name value2 "Label 2":)

And indeed the input elements will have the same look and feel as other 
forms on the wiki.

One way to do user interaction is to have a conditional based on the 
global request variables.

I added a section "User interaction" with an example directive on this 
page:

   https://www.pmwiki.org/wiki/Cookbook/MarkupDirectiveFunctions

Looking at your quiz script, in order to simplify the code logic and 
session handling, I might do these changes:

1. I might make separate wiki pages for each quiz category.

2. In a quiz, once the questions and answers are generated, I might 
display all questions in the same page, that is 10 questions per page 
not 1.

3. When the results are shown, I'd include links to the relevant wiki 
pages, so users can click to read about the topic. :-)

Gobe.si is a wiki with amazing content, great work!

Petko



More information about the pmwiki-users mailing list