1. Instructions for participants
In your folder C:\\xampp\\htdocs\\exp, you find the 21 files of the example experiment introduced in the kick-starter guide. Most of them code for the various screens shown to the participants’ of the experiment. Let us have a look at the code for the instructions page.
Open the file instructions.php in your editor. You will see a typical LIONESS script of about 90 lines of code, containing the information for displaying the instructions page to the participants. All scripts in this example program have the same basic set-up, and by going through this first script in some detail, we will see most of the basic elements of our programs. You will notice that each of the scripts of this example program contains extensive annotation to clarify the functioning of each of their parts in normal language.
The first 20 lines are written in PHP and are executed on the server; the rest of the code is mainly written in HTML, but we will get to that part later. In the PHP script we start by loading a library sql_library, which contains some handy functions to read from and write to the database (line 3). Next, we check whether the client is logged in to the server – by reading a cookie that has been written to the participant’s browser before – and read the needed parameters from the server, making them available for display. Finally, we update the variable onPage on the server, so that the experimenter can track the participant’s progress in the experiment via the control panel.
Proceed to explore the code for the quiz page.