Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
en:create:functions:getquestions [13.01.2015 20:29] – created alexander.ritteren:create:functions:getquestions [24.01.2015 15:47] – [Examples] alexander.ritter
Line 1: Line 1:
 ====== getQuestions() ====== ====== getQuestions() ======
  
-''array **getQuestions**(string //RubrikKennung//)''+''array **getQuestions**(string //sectionID//)''
  
-Die Funktion ''getQuestions()'' liefert eine Liste aller Frage-Kennungen einer Rubrik+The function ''getQuestions()'' returns a list of all question IDs in a particular section.
  
-  * //RubrikKennung//\\ Die zweistellige Kennung einer Rubrik.+  * //sectionID//\\ The two-figure ID of a section
  
-===== Rückgabewert =====+===== Return Value =====
  
-Die Funktion liefert ein Array mit vollständigen Frage-Kennungen, als z.B.+The function returns an array with complete questions IDs as e.g
  
   array('AB01', 'AB02', 'AB04')   array('AB01', 'AB02', 'AB04')
  
-Falls keine Rubrik mit der angegeben //RubrikKennung// existiertwird ein leeres Array zurückgegeben.+If no section exists with the specified //sectionID//, an empty array will be returned.
  
-===== Beispiele =====+===== Examples ===== 
 + 
 +The following PHP code shows all questions of a section one below the other (on one page).
  
-Folgender PHP-Code zeigt untereinander (auf einer Seite) alle Fragen einer Rubrik. 
  
 <code php> <code php>
 $questions = getQuestions('AB'); $questions = getQuestions('AB');
-// Liefert z.B. AB01, AB02, AB04, AB05+// Returns e.g. AB01, AB02, AB04, AB05
 foreach ($questions as $qID) { foreach ($questions as $qID) {
   question($qID);   question($qID);
Line 27: Line 28:
 </code> </code>
  
-Folgender PHP-Code zeigt alle Fragen einer Rubrik, jeweils auf einer eigenen Seite (s. PHP-Funktion ''[[:de:create:functions:looppage|loopPage()]]'').+The following PHP code shows all questions in a section with each one on a separate page (see PHP function ''[[:en:create:functions:looppage|loopPage()]]''). 
  
 <code php> <code php>
Line 35: Line 36:
 </code> </code>
  
-Und folgender PHP-Code wählt aus den Fragen der Rubrik "AB" zufällig 4 aus und zeigt diese auf unterschiedlichen Seiten an.+And the following PHP code selects 4 questions from section "AB" at random and shows these on different pages. 
  
 <code php> <code php>
-// Die zufällige Liste nur einmal erstellen+// Create the random list only once
 if (!isset($questions)) { if (!isset($questions)) {
   $all = getQuestions('AB');   $all = getQuestions('AB');
Line 45: Line 47:
   registerVariable('questions');   registerVariable('questions');
 } }
-// Jeweils eine Frage anzeigen+// Each show a question
 $i = loopPage(4); $i = loopPage(4);
 question($questions[$i]); question($questions[$i]);
 </code> </code>
en/create/functions/getquestions.txt · Last modified: 24.01.2015 15:48 by alexander.ritter
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki