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
en:create:functions:reference [24.01.2015 12:43] – [Example 2] alexander.ritteren:create:functions:reference [25.03.2022 22:06] (current) admin
Line 26: Line 26:
 ===== Example 2 ===== ===== Example 2 =====
  
-The use of the reference can be useful if other information is encoded within it. In the following example, social scientists would have "Axxx" as a reference (e.g. A100, A201, A991), and natural scientists get a "BXXX" reference (e.g. B100, B201, B990) in the URL.+The use of the reference can be useful if other information is encoded within it. In the following example, social scientists would have "Axxx" as a reference (e.g. A100, A201, A991), and natural scientists would have a "BXXX" reference (e.g. B100, B201, B990) in the URL.
  
-Depending on the reference, question "AB01" or "AB02" will now be displayed. The first character has to first be extracted from the reference in order to so by  using ''{0}''. PHP's own function ''[[http://php.net/manual/en/function.strtoupper.php|strtoupper()]]'' ensures that potential lower case letters are converted into upper case.+Depending on the reference, question "AB01" or "AB02" will now be displayed. In order to do so, the first character of the reference has to be extracted by using ''[0]''. PHP's own function ''[[http://php.net/manual/en/function.strtoupper.php|strtoupper()]]'' ensures potential lower case letters are converted into upper case.
  
 <code php> <code php>
Line 35: Line 35:
   // No reference submitted (less than 1 character)   // No reference submitted (less than 1 character)
   goToPage('next');   goToPage('next');
-} elseif ($ref{0== 'A') {+} elseif ($ref[0== 'A') {
   question('AB01');  // question for social scientists   question('AB01');  // question for social scientists
-} elseif ($ref{0== 'B') {+} elseif ($ref[0== 'B') {
   question('AB02');  // question for natural scientists   question('AB02');  // question for natural scientists
 } else { } else {
en/create/functions/reference.txt · Last modified: 25.03.2022 22:06 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