Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
en:create:functions:random_items [13.01.2015 16:02] – [random_items()] alexander.ritteren:create:functions:random_items [13.01.2015 16:14] – [Examples] alexander.ritter
Line 8: Line 8:
   * //number//\\ Number of items that should be drawn. If the second parameter is omitted, the items will be returned in a random order.   * //number//\\ Number of items that should be drawn. If the second parameter is omitted, the items will be returned in a random order.
  
-**Note:** As a rule, enabling item rotation directly in the question (//Items' order// -> "Shuffle/rotate randomly") is preferred over using the function ''random_items()''. This function only provides useful added value if the same random selection is needed again in a later question, of if not all of the items should be displayed. +**Note:** As a rule, enabling item rotation directly in the question (//Items' order// -> "Shuffle/rotate randomly") is preferred over using the function ''random_items()''. This function only provides real added value if the same random selection is needed again in a later question, or if not all of the items should be displayed. 
  
 ===== Examples ===== ===== Examples =====
Line 20: Line 20:
 </code> </code>
  
-**Tip:** If questions AB01 and AB02 should be asked on different pages, use ''[[:en:create:functions:registervariable|registerVariable('items')]]'' in order to make the variable ''$items'' available for use on future pages.+**Tip:** If questions AB01 and AB02 should be asked on different pages, use ''[[:en:create:functions:registervariable|registerVariable('items')]]'' to make the variable ''$items'' available for use on future pages.
  
 In the following example, 3 items are randomly selected from items 1,2,3,4,9 and 9, and questions AB01 and AB02 are only shown with these items. In the following example, 3 items are randomly selected from items 1,2,3,4,9 and 9, and questions AB01 and AB02 are only shown with these items.
Line 37: Line 37:
 </code> </code>
  
-The same result can be obtained, however, with a corresponding parameter in the command ''[[en:create:functions:question|question()]]''.+The same result can be also obtained, however, with a corresponding parameter in the command ''[[en:create:functions:question|question()]]''.
  
 <code php> <code php>
 question('AB01', 'random=3'); question('AB01', 'random=3');
 </code> </code>
en/create/functions/random_items.txt · Last modified: 11.04.2018 09:05 by admin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki