Micro-Donations
If you are successfully making use of Mad Blanks for Joomla!, or if I have given you useful support, please donate $1 or more.
I pass on 10% of donations I receive through this site to the Joomla! project, so by supporting me, you're also supporting Joomla!
Thank you,
-Chris
The Starfish Story
|
|
Score Scripting special tag reference |
|
|
|
|
Written by Chris Hallett
|
|
Saturday, October 10, 2009 |
|
The Score Script is the key area in which the administrator configures how Joomla! responds to the website user as well as other actions Joomla! performs at the time when a Mad Blanks quiz/survey or other Mad Blanks input form is submitted. Other actions besides displaying dynamic text and HTML to the user can include initiating email or calling Plugins (formerly known as Mambots) that operate on the output of the Score Script. Go directly to the Score Script special tag reference Note to advanced users of Joomla!: While by no means required to create a useful Score Script, calling a Plugin within the Score Script that allows the use of inline PHP (such as the new Jumi 2.1 Beta 3) greatly enhances the power of the Score Script, because all of the Score Script variables documented below can be passed to PHP code for further processing, making the possibilities for creating the output you desire virtually limitless. Since a Score Script can include HTML, it is also possible to pass these variables to JavaScript code that runs in the user's browswer. Remember that the PHP will operate on the final output generated by the Score Script. That means you can pass Score Script variables/output to PHP or JavaScript but you cannot pass PHP or JavaScript back to the Score Script.
The following Special Tags reference is taken out of the documentation within Mad Blanks 1.2.2 (updated October 11, 2009). This same documentation can be viewed when editing a Score Script in the Special tags quick reference section on the Score Script edit page. Special tags: These are available to use in the Score Scripts - [:comment:<start>:]Some comment text[:comment:<end>:]
- A comment
- [:category_id:]
- The ID number of the category
- [:category_name:]
- The name of the category
- [:record_id:]
- The id number of the record that is currently being scored (available if the Create Single Record module parameter labeled Save the record inputted by the user? is set to Save in the database)
- [:number_of_correct_answers:]
- The number of questions the user answered correctly
- [:number_of_incorrect_answers:]
- The number of questions the user answered incorrectly
- [:total_answers_in_category:]
- The number of questions in the category that have correct answers
- [:ratio_correct:]
- The number of correct responses divided by the number of questions with correct answers
- [:percentage_correct:]
- The number of correct responses divided by the number of questions with correct answers, expressed as a rounded whole number percentage
- [:total_points_earned_a:]
- The total type A points earned by the user for the entire quiz (type A point values are specified per question)
- [:total_points_possible_a:]
- The total possible type A points that the user can earn
- [:points_ratio_a:]
- The number of type A points earned divided by the number of type A points possible to earn
- [:points_percentage_a:]
- The number of type A points earned divided by the number of type A points possible to earn, expressed as a rounded whole number percentage
- [:total_points_b:]
- The total type B points from all selected answers in every question (point values that are specified for each response to a particular question)
- [:total_points_earned_b:]
- The total type B points from all correct questions (point values that are specified for each response to a particular question)
- [:total_points_all_correct_b:]
- The total type B points the user would earn if only correct answers for all questions are all selected
- [:total_points_correct_ratio_b:]
- The total type B points from all correct questions divided by total type B points the user would earn if all answers were answered correctly
- [:total_points_correct_percentage_b:]
- The total type B points from all correct questions divided by total type B points the user would earn if all answers were answered correctly, expressed as a rounded whole number percentage
- [:total_sum_all_points_b:]
- The sum of all type B points from every option in every question
- [:total_accrued_sum_ratio_b:]
- The actual accrued type B points divided by the sum of all type B points from every option in every question
- [:total_accrued_sum_percentage_b:]
- The actual accrued type B points divided by the sum of all type B points from every option in every question, expressed as a rounded whole number percentage
- [:printf:xyz:<start>:]String to be formatted with PHP's printf() function[:printf:<end>:]
-
Format the string between the opening and closing tags according to the format xyz. The syntax is the same as that used by PHP's printf() and sprintf() functions. See http://php.net/sprintf for format syntax. One use of this feature is to format a number with leading or trailing zeroes. Examples: [:printf:%07.1f:<start>:]497.1[:printf:<end>:] => displays as 00497.1 [:printf:%01.2f:<start>:]497.1[:printf:<end>:] => displays as 497.10 - [:redirect:<xyz>:]
- Redirect to relative or absolute URL xyz.
- [:nextcategory:n:]
- After displaying the current Score Script, automatically direct the Create Single Record module to take input for category number n next. If n is 0 (zero), show no further categories. Use this feature to string together multiple quizzes or surveys one after another.
- [:info:n:tagname:]
This is a piece of information about question/user response number n. Replace tagname with any of the following: - name
- The name of the field (the question or prompt to the user)
- cluecuehint
- The clue/cue/hint for the field
- beforetext
- The text that comes before the user's response
- aftertext
- The text that comes after the user's response
- user_response
- The user's response to this question or prompt
- user_response_raw
- The user's response to this question or prompt before processing the multiple response separators
- points_b
- The sum of the type B point values of the user's selected responses for this question
- points_b_sum
- The sum of the type B point values of all the configured responses for this question or prompt
- points_b_max
- The type B point value of the configured response with the highest point value
- points_b_min
- The type B point value of the configured response with the lowest point value
- points_b_avg
- The average type B point value of all the configured responses
- points_b_avg_integer
- The average type B value of all the configured responses, rounded to the nearest integer
- possible_choice:m
- The mth possible response to the question (from the "List the options to be shown for multiple choice" list)
- possible_choice_selected:m
- If the mth possible response to the question (from the "List the options to be shown for multiple choice" list) was actually selected by the user, this is 1 (one). If it was not actually selected by the user, this is 0 (zero).
- point_value_b:m
- The point value for the mth possible response to the question (from the "Type B points" list)
- [:answer:n:tagname:]
This is a piece of information about question/user response number n, which has a correct answer. If a Mad Blanks field does not have a "Correct response" defined on the category edit page, this tag will not be available for that field. Replace tagname with any of the following: - name
- The name of the field (the question or prompt to the user)
- cluecuehint
- The clue/cue/hint for the field
- beforetext
- The text that comes before the user's response
- aftertext
- The text that comes after the user's response
- correct_value
- The correct response to this question or prompt
- correct_value_raw
- The correct response to this question or prompt before processing the multiple response separators
- correct_case_sensitive
- If the correct response to this question or prompt must be entered with exact case, this is 1 (one); if the response does not need to match case exactly, this is 0 (zero)
- user_response
- The user's response to this question or prompt
- user_response_raw
- The user's response to this question or prompt before processing the multiple response separators
- is_correct
- This is 1 (one) if the user's response is correct and 0 (zero) if the user's response is incorrect
- points_possible_a
- The type A (per question) points possible to earn for this question
- points_earned_a
- The number of type A (per question) points the user earned for this question/response (applies if user answered correctly, otherwise this is 0 [zero])
- points_earned_b
- The number of type B (per response) points the user earned for this question/response (applies if user answered correctly, otherwise this is 0 [zero])
- [:answers_correct:n:<start>:]Some HTML/text that may include other special tags[:answers_correct:n:<end>:]
-
When the number of correct answers is n in the quiz response to be scored, display the HTML/text in between these two tags. The text may include other special tags. Examples: [:answers_correct:0:<start>:]<p>Because you answered ZERO questions correctly, you are seeing this.</p>[:answers_correct:0:<end>:] [:answers_correct:2:<start>:]<p>Because you answered TWO questions correctly, you are seeing this.</p>[:answers_correct:2:<end>:] - [:points_a_range:n1-n2:<start>:]Some HTML/text that may include other special tags[:points_a_range:n1-n2:<end>:]
-
When the type A points earned as determined by the category setup is in the range including n1-n2, display the HTML/text in between these two tags. The text may include other special tags. Examples: [:points_a_range:0-49:<start>:]<p>Because you earned between zero and forty nine points, you are seeing this.</p>[:points_a_range:0-49:<end>:] [:points_a_range:900-950:<start>:]<p>Because you earned between nine hundred and nine hundred fifty points, you are seeing this.</p>[:points_a_range:900-950:<end>:] - [:points_b_range:n1-n2:<start>:]Some HTML/text that may include other special tags[:points_b_range:n1-n2:<end>:]
-
When the type B points earned as determined by the category setup is in the range including n1-n2, display the HTML/text in between these two tags. The text may include other special tags. Examples: [:points_b_range:0-49:<start>:]<p>Because you earned between zero and forty nine points, you are seeing this.</p>[:points_b_range:0-49:<end>:] [:points_b_range:900-950:<start>:]<p>Because you earned between nine hundred and nine hundred fifty points, you are seeing this.</p>[:points_b_range:900-950:<end>:] - [:answer:n:<start_correct>:]Some HTML/text that may include other special tags[:answer:n:<end_correct>:]
-
When the response for field number n is correct, display the text in between these two tags. The text may include other special tags. Examples: [:answer:5:<start_correct>:]<p>Your answer to question number five was correct.</p>[:answer:5:<end_correct>:] [:answer:10:<start_correct>:]<p>Your answer to question number ten was correct.</p>[:answer:10:<end_correct>:] - [:answer:n:<start_incorrect>:]Some HTML/text that may include other special tags[:answer:n:<end_incorrect>:]
-
When the response for field number n is incorrect, display the text in between these two tags. The text may include other special tags. Examples: [:answer:5:<start_incorrect>:]<p>Your answer to question number five was WRONG.</p>[:answer:5:<end_incorrect>:] [:answer:10:<start_incorrect>:]<p>Your answer to question number ten was WRONG.</p>[:answer:10:<end_incorrect>:] - [:each:info:<start>:]Some HTML/text that also includes one or more of the following special tags[:each:info:<end>:]
-
This is a block of HTML/text that loops and is output once for each field. It may contain any of the following special tags: - [:name:]
- The name of the field (the question or prompt to the user)
- [:cluecuehint:]
- The clue/cue/hint for the field
- [:beforetext:]
- The text that comes before the user's response
- [:aftertext:]
- The text that comes after the user's response
- [:field_number:]
- The ID number of the field
- [:field_number_padded:]
- The two digit ID number of the field that may have a leading zero added
- [:user_response:]
- The user's response to this question or prompt
- [:user_response_raw:]
- The user's response to this question or prompt before processing the multiple response separators
- [:points_b:]
- The type B point value of the selected responses for this question
- [:points_b_sum:]
- The sum of the point values for all the responses
- [:points_b_max:]
- The point value of the response with the highest point value
- [:points_b_min:]
- The point value of the response with the lowest point value
- [:points_b_avg:]
- The average point value of all the responses
- [:points_b_avg_integer:]
- The average value of all the responses, rounded to the nearest integer
- [:possible_choice:n:]
- The nth possible response to the question (from the "List the options to be shown for multiple choice" list)
- [:possible_choice_selected:n:]
- If the nth possible response to the question (from the "List the options to be shown for multiple choice" list) was actually selected by the user, this is 1 (one). If it was not actually selected by the user, this is 0 (zero).
- [:point_value_b:n:]
- The point value for the nth possible response to the question (from the "Is there a point value" list)
- [:accrued_sum_ratio_b:]
- The actual accrued type B points divided by the sum of all type B points from every option
- [:accrued_sum_percentage_b:]
- The actual accrued type B points divided by the sum of all type B points from every option, expressed as a rounded whole number percentage
- [:each:answer:<start>:]Some HTML/text that also includes one or more of the following special tags[:each:answer:<end>:]
-
This is a block of HTML/text that loops and is output once for each field that has a correct answer. If a particular Mad Blanks field does not have a "Correct response" defined on the category edit page, that field will not iterated for this loop. This HTML/text may contain any of the following special tags: - [:<start_correct>:]Some HTML/text that may include other special tags[:<end_correct>:]
- When the response for field of the current loop is correct, display the text in between these two tags. The text may include other special tags, including the ones below.
- [:<start_incorrect>:]Some HTML/text that may include other special tags[:<end_incorrect>:]
- When the response for the field of the current loop is incorrect, display the text in between these two tags. The text may include other special tags, including the ones below.
- [:name:]
- The name of the field (the question or prompt to the user)
- [:cluecuehint:]
- The clue/cue/hint for the field
- [:beforetext:]
- The text that comes before the user's response
- [:aftertext:]
- The text that comes after the user's response
- [:field_number:]
- The ID number of the field
- [:field_number_padded:]
- The two digit ID number of the field that may have a leading zero added
- [:correct_value:]
- The correct response to this question or prompt
- [:correct_value_raw:]
- The correct response to this question or prompt before processing the multiple response separators
- [:correct_case_sensitive:]
- If the correct response to this question or prompt must be entered with exact case, this is 1 (one); if the response does not need to match case exactly, this is 0 (zero)
- [:user_response:]
- The user's response to this question or prompt
- [:user_response_raw:]
- The user's response to this question or prompt before processing the multiple response separators
- [:is_correct:]
- This is 1 (one) if the user's response is correct and 0 (zero) if the user's response is incorrect
- [:points_earned_a:]
- The number of type A (awarded per question) points the user earned for this question
- [:points_possible_a:]
- The number of type A points possible to earn for this question
- [:points_earned_b:]
- If the question was answered correctly, this is the number of type B points (awarded per response within each question) the user earned; otherwise, this is 0 (zero)
- [:points_all_correct_b:]
- The number of type B points the user would earn if only correct answers were selected for this question
- [:points_correct_ratio_b:]
- The total earned type B points divided by total type B points the user would earn if the answer were completely correct
- [:points_correct_percentage_b:]
- The total earned type B points divided by total type B points the user would earn if the answer were completely correct, expressed as a rounded whole number percentage
- [:email:]
-
This special tag is used to send an email message. The email settings on the Mail tab of the Global Configuration of your Joomla! installation govern what method is used to send the email. One or more of the following elements can be added to the email special tag. Each entry must be separated by a colon. See the examples below the explanations of the email elements. - from{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
} OR from{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
;From Name}
- The from address of the email message; This is a single email address, optionally followed by a semicolon and a name associated with the email address; This field can contain special tags that would be found in a Score Script and resolve to the desired content; If not specified in the special tag and if no default is specified in the value of the Mad Blanks configuration variable mbDefaultSSEmailFrom, the 'Mail From' email address and 'From Name' name in the Joomla! configuration are used
- to{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
} OR to{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
,
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
,
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
, ...}
- One or more email addresses to send the email message to; This is a single address or a comma-delimited list of email addresses; This field can contain special tags that would be found in a Score Script and resolve to the desired content; If not specified in the special tag and if no default is specified in the value of the Mad Blanks configuration variable mbDefaultSSEmailTo, the 'Mail From' email address in the Joomla! configuration is used
- subject{The Subject}
- The subject of the email message; This field can contain special tags that would be found in a Score Script and resolve to the desired content; If not specified in the special tag, the value of the Mad Blanks configuration variable mbDefaultSSEmailTo is used as the subject
- body{The Body}
- The body of the email message; This field can contain special tags that would be found in a Score Script and resolve to the desired content; If not specified in the special tag, the value of the Mad Blanks configuration variable mbDefaultSSEmailBody is used as the body
- html_mode{0} OR html_mode{1}
- The mode of the email message; This value is 0 for a plain text email or 1 for an email that uses HTML. This field can contain special tags that would be found in a Score Script and resolve to the desired content; If not specified in the special tag, the value of the Mad Blanks configuration variable mbDefaultSSEmailMode is used as the mode
- cc{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
} OR cc{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
,
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
,
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
, ...}
- One or more email addresses to send a 'carbon copy' of the email message to; This is a single address or a comma-delimited list of email addresses; This field can contain special tags that would be found in a Score Script and resolve to the desired content; If not specified in the special tag, the value of the Mad Blanks configuration variable mbDefaultSSEmailCC is used
- bcc{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
} OR bcc{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
,
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
,
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
, ...}
- One or more email addresses to send a 'blind carbon copy' of the email message to; This is a single address or a comma-delimited list of email addresses; This field can contain special tags that would be found in a Score Script and resolve to the desired content; If not specified in the special tag, the value of the Mad Blanks configuration variable mbDefaultSSEmailBCC is used
- attachment{/path/filename} OR attachment{/path1/filename1,/path2/filename2}
- The filename of one or more attachments to the email message; This is a single file name or a comma-delimited list of file names, the format of which are server-dependent; This field can contain special tags that would be found in a Score Script and resolve to the desired content; If not specified in the special tag, the value of the Mad Blanks configuration variable mbDefaultSSEmailBCC is used; WARNING: EMAIL ATTACHMENTS MUST BE EXPLICITLY ENABLED by commenting out a line in madblanks.class.php labeled with the following: "WARNING: EMAIL ATTACHMENTS ARE DISABLED UNLESS THE NEXT LINE IS REMOVED OR COMMENTED OUT"
- reply_to{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
} OR reply_to{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
;Reply Name} OR reply_to{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
,
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
} OR reply_to{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
;Reply Name One,
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
;Reply Name Two}
- One or more 'Reply To' addresses for the email message; This is a single address or a comma-delimited list of email addresses; each email address can optionally be followed by a semicolon and a name associated with the email address; This field can contain special tags that would be found in a Score Script and resolve to the desired content; If not specified in the special tag, the value of the Mad Blanks configuration variable mbDefaultSSEmailAttachment is used
- success_message{text/HTML and/or Score Script tags}
- This text/HTML replaces the email special tag in the Score Script when sending the email is successful; This field can contain special tags that would be found in a Score Script and resolve to the desired content; If not specified in the special tag, the value of the Mad Blanks configuration variable mbDefaultSSEmailSuccess is used
- failure_message{text/HTML and/or Score Script tags}
- This text/HTML replaces the email special tag in the Score Script when sending the email fails; This field can contain special tags that would be found in a Score Script and resolve to the desired content; If not specified in the special tag, the value of the Mad Blanks configuration variable mbDefaultSSEmailFailure is used
Note that curly brackets cannot be included inside any of the above tags. Instead, use [:curlyl:] and [:curlyr:]. Examples: [:email:] This email message uses all default values from the Mad Blanks configuration variables. [:email:to{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
}:bcc{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
}:] This email message specifies one 'to' email address and one 'blind carbon copy' email address and uses the default values from the Mad Blanks configuration variables for all the other elements of the email message. [:email:from{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
;From Name}:to{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
,
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
,
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
}:subject{This is the Subject}:body{<h1>This is the Body.</h1> It includes <b>HTML</b>}:html_mode{1}:cc{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
,
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
,
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
}:success_message{The email was sent successfully.}:failure_message{<h1>The message could not be sent. Check for errors in the email special tag.</h1>}:attachment{/tmp/image1.jpg}:reply_to{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
;Reply One Name,
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
;Reply Two Name}:bcc{
This e-mail address is being protected from spam bots; you need JavaScript enabled to view it
}:] This is a complex example that uses all of the available elements of an email message. Note that the elements do not have to appear in a particular order. - [:date:]
-
Insert a datestamp/timestamp into the Score Script. There are three possible forms of this tag: - [:date:]
- Display the default date and time according to the value of the Mad Blanks configuration variable mbDefaultSSDateFormat, which uses the syntax of PHP's strftime function (see http://php.net/strftime); If that variable is not specified, _DATE_FORMAT_LC2 from Joomla's relevant language file will be used, if available, or %d %b %Y %I:%M %p will be used. The offset value of the Mad Blanks configuration variable mbDefaultSSDateAdjustment will also be used. If not specified, an offset of zero will be used.
- [:date:<format>:]
- Display the date and time according to the format format, which is placed inside a pair of angle brackets; The syntax is according to PHP's strftime function (see http://php.net/strftime). The value of the Mad Blanks configuration variable mbDefaultSSDateAdjustment will also be used. If not specified, an offset of zero will be used.
- [:date:<format>:offset:]
- Display the date and time according to the format format; The syntax is according to PHP's strftime function (see http://php.net/strftime). A plain English time adjustment offset is specified. This is accomplished via PHP's strtotime function (see http://php.net/strtotime).This is useful if the server is in a different time zone than your website or if the server clock is incorrect and out of your control. Examples for the offset: -5 hours or +2min +25sec
- [:arithmetic:{1st operand}:operator:{2nd operand}:]
-
This is the arithmetic operator tag. It allows you to perform arithmetic within a Score Script. The 1st operand and 2nd operand are replaced with the values to perform the arithmetic on. These operands can include special tags within the curly brackets ({}). Replace operator with any of the following: - +
- Add 1st operand to 2nd operand
- -
- Subtract 2nd operand from 1st operand
- *
- Multiply 1st operand by 2nd operand
- /
- Divide 1st operand by 2nd operand
- %
- Get the modulus (division remainder) when dividing 1st operand by 2nd operand
Examples: [:arithmetic:{3}:+:{2}:] Add 3 to 2. (The result displayed in the Score Script is 5.) [:arithmetic:{[:info:1:user_response:]}:*:{[:info:2:user_response:]}:] Multiply the user's response for field 1 by the user's response for field 2 and display the result in the Score Script. - [:comparison:{1st operand}:operator:{2nd operand}:{true}:{false}:]
-
This is the comparison operator tag. It allows you to perform comparisons within a Score Script. The 1st operand and 2nd operand are compared according to the operator being used. If the comparison is true, the entire tag is replaced with true. If the comparison is false, the entire tag is replaced with false. The operands and true and false can include special tags within the curly brackets ({}). Replace operator with any of the following: == eq - True if 1st operand equals 2nd operand
!= <> ne - True if 1st operand is not equal to 2nd operand
< lt - True if 1st operand is less than 2nd operand
> gt - True if 1st operand is greater than 2nd operand
<= le - True if 1st operand is less than or equal to 2nd operand
>= ge - True if 1st operand is greater than or equal to 2nd operand
Examples: [:comparison:{3}:<:{2}:{Three is less than two.}:{Three is not less than two.}:] Compare 3 to 2. Since 3 is not less than 2, the result is false. Therefore the entire tag is replaced with Three is not less than two. [:comparison:{[:info:1:user_response:]}:!=:{[:info:2:user_response:]}:{You entered two different values.}:{You entered the same value twice.}:] Find out if the user's response for field 1 and the user's response for field 2 are not equal. If they are not equal, the entire tag is replaced with You entered two different values.. If they are equal, the entire tag is replaced with You entered the same value twice.. [:comparison:{[:info:1:user_response:]}:>=:{[:info:2:user_response:]}:{[:total_points_earned_a:]}:{[:total_points_earned_b:]}:] Find out if the user's response for field 1 is greater than or equal to the user's response for field 2. If the comparison is true, the entire tag is replaced with the total type a points earned. If the condition is false, the entire tag is replaced with the total type b points earned. - [:logical:{1st operand}:operator:{2nd operand}:{true}:{false}:]
-
This is the logical operator tag. It allows you to perform logic within a Score Script. Each operand is classified as TRUE (a non-zero value) or FALSE (zero or doesn't exist). The logical condition corresponding to the operator is then calculated. If the condition is true, the entire tag is replaced with true. If the condition is false, the entire tag is replaced with false. The operands and true and false can include special tags within the curly brackets ({}). Replace operator with any of the following: and && - True if 1st operand and 2nd operand are both TRUE
or || - True if 1st operand is TRUE or 2nd operand is TRUE
xor - True if 1st operand is TRUE or 2nd operand is TRUE, unless both are true in which case the condition is false
not ! - True if 1st operand is FALSE; 2nd operand is ignored
Examples: [:logical:{1}:and:{2}:{Yes}:{No}:] Check if 1 and 2 are both TRUE (a non-zero value). Since they both are, the result is true. Therefore the entire tag is replaced with Yes. [:logical:{[:info:1:user_response:]}:or:{[:info:2:user_response:]}:{At least one of the values you entered is TRUE.}:{You did not enter any TRUE values.}:] Check if either the user's response for field 1 or the user's response for field 2 is TRUE (a non-zero value). If one or both are TRUE, the entire tag is replaced with At least one of the values you entered is TRUE.. If neither of the responses is TRUE, the entire tag is replaced with You did not enter any TRUE values.. [:logical:{[:info:1:user_response:]}:!:{}:{[:date:<%m/%d/%y>:]}:{[:date:<%d/%m/%y>:]}:] Check if the user's response for field 1 is FALSE (zero or doesn't exist). If so, the entire tag is replaced with the date in month/day/year format. Otherwise, the entire tag is replaced with the date in day/month/year format. Note that the contents of 2nd operand, had they been present, would have been ignored. - <expression:n>An expression containing text/HTML and/or special tags</expression>
-
This is an expression declaration, used to define expressions that can be used elsewhere in the Score Script. An expression can be a simple text string and it can contain special tags. Replace n with a unique non-zero whole number; this same number will be used in the corresponding expression special tag to recall the contents of the expression declaration. Examples: <expression:1>This is a simple expression in the form of text.</expression> The expression declaration contains text. <expression:2>[:arithmetic:{[:answer:1:user_response:]}:/:{[:answer:2:user_response:]}:]</expression> The expression declaration contains a special tag. - [:expression:n:]
-
This is an expression tag, which is replaced with the contents of the corresponding expression definition (number n). The n can be derived from simple Score Script tags that evaluate to a non-zero whole number. - [:user_id_number:]
- The system ID number of the user (0 if the user is not logged in)
- [:user_name:]
- The username of the user (blank if the user is not logged in)
- [:user_full_name:]
- The full name of the user (blank if the user is not logged in)
- [:user_email:]
- The email address of the user (blank if the user is not logged in)
- [:user_type:]
- The user type (blank if the user is not logged in)
- [:user_register_date:]
- The date the user registered (blank if the user is not logged in)
- [:user_last_visit_date:]
- The date the user last visited (blank if the user is not logged in)
- [:user_is_guest:]
- This is 1 (one) if the user is a guest (not logged in) or 0 (zero) if the user is logged in
- [:user_ip_address:]
- The user's IP address (if available from the web server)
- [:user_host:]
- The user's host name (if available from the web server - in Apache you'll need HostnameLookups On inside httpd.conf)
- [:user_user_agent:]
- The "user agent" web browser information from the user's web browser (if available from the web server)
- [:user_referer:]
- The address of the web page the user was on before submitting the form to reach the Score Script (if available from the web server)
- <logdata:n>Data from the Score Script to log as part of the Mad Blanks record</logdata>
-
Log the output between the opening and closing logdata tags to the Mad Blanks record. Currently logdata:1 and logdata:2 are supported. This has no effect if the Create Single Record module's parameter labeled Save the record inputted by the user? is set to Display only; don't save in the database. Any data that can be generated natively by the Score Script can be saved this way. If there is already logged data in a Mad Blanks record it will not be overwritten. Examples: <logdata:1>[:percentage_correct:]</logdata> Logs the user's "percentage correct" score in the record's scodata1 field <logdata:2>IP address: [:user_ip_address:] Browser Information: [:user_user_agent:]</logdata> Logs the user's IP address and web browser information along with some labeling text in the record's scodata2 field; note that the linebreak is also saved [:popupwindow:{window text/HTML content}:{window features and settings}:] -
Note that the popupwindow uses JavaScript to open the window, and is therefore not a reliable method to present information to a website user. JavaScript may be disabled in her or his browser, and popup windows may be blocked. Double quotation marks should not be used in the content of the popupwindow. Instead, substitute single quotation marks inside HTML tags and the [:quot:] special tag otherwise. Examples: [:popupwindow:{If it was not blocked, this window has just popped up.}:] Simple example using plain text; DON'T USE DOUBLE QUOTATION MARKS IN YOUR TEXT, instead substitute single quotation marks [:popupwindow:{<b>This is the <span style='color: red;'>popup window</span> for category [:category_name:]</b>}:{height=200, width=500, resizable=yes}:] Example using HTML and special tags in the first argument and comma delimited window features in the second argument; these window features are the same as would be used for the third argument of JavaScript's window.open() method and are as follows: | Note: non-numerical values can be set to yes or no | | height | the height (in pixels) of the window's document display area | | left | the X coordinate (in pixels) of the window | | location | show the input field for entering URLs into the browser | | menubar | show the menu bar | | resizable | allow window to be resized | | scrollbars | show horizontal and vertical scrollbars when they are necessary | | status | show the status line | | toolbar | show the toolbar (back/forward buttons, etc.) | | top | the Y coordinate (in pixels) of the window | | width | the width (in pixels) of the window's document display area | Note that JavaScript is not the same from browser to browser and some of these features may be unavailable in particular browsers. - [:quot:]
- Quotation mark (do not use a normal quotation mark unless it is part of an HTML tag)
- [:space:]
- Space (useful at the beginning or end of the field because normal spaces are trimmed off the ends)
- [:nbsp:]
- Nonbreaking space
- [:lt:]
- Less-than sign (do not use a normal less-than sign unless it is part of an HTML tag)
- [:gt:]
- Greater-than sign (do not use a normal greater-than sign unless it is part of an HTML tag)
- [:br:]
- Linebreak (new line)
- [:curlyl:]
- Left curly bracket {
- [:curlyr:]
- Right curly bracket }
- [:random@category_id,field:]
- Insert the value from field number field in a record chosen at random in the category with id number category_id. You can provide multiple category/field pairs for the randomizer to choose from by separating them with additional @ characters. Examples:
To show a random entry for field seven in the category with id two: [:random@2,7:] To show a random entry for field nine in either the category with id two or the category with id three: [:random@2,9@3,9:] To show a random entry for field seven in category five, field four in category ten, or field two in category one: [:random@5,7@10,4@1,2:] Note: Once a tag is used, the value that tag returned is remembered for the rest of the record processing. Therefore, if you use the same tag again within the same record, the same result will be returned. If you want to create a newly randomized result, you must use a different tag. For example, instead of using [:random@2,7:] again, use [:random@2,7@2,7:]. - [:lookup@record_id,field:]
-
Insert the looked up value from record number record_id and field number field within that record. You can also use the keyword this in place of a record number to refer to the currently displayed record. Examples: To show the entry in record #123 for field seven: [:lookup@123,7:] To show the entry for field nine of the currently displayed record: [:lookup@this,9:] Note that the looked up value will appear exactly as it does in the looked up field, including the effects of any field text formatting functions that may have been applied. To override the field text formatting functions that were applied to the original and to optionally apply new field text formatting functions, append an additional argument within the lookup tag as follows: [:lookup@record_id,field,nnnn:] Here, each n is a zero or a one. All four digits as zeroes will cause no field text formatting functions to be applied. The first n, set to 1, will cause "ALL UPPERCASE" to be applied to the looked up value. The second n, set to 1, will cause "all lowercase" to be applied to the looked up value. The third n, set to 1, will cause "Each Word Uppercase" to be applied to the looked up value. The fourth n, set to 1, will cause "First word uppercase" to be applied to the looked up value. Examples: To show the entry in record #123 for field seven with no field text formatting functions applied, even though they may be applied in the original field: [:lookup@123,7,0000:] To show the entry for field nine of the currently displayed record, with "Each Word Uppercase" applied: [:lookup@this,9,0010:] - [:mostrecentlookup@field,category(optional),user_id(optional),format(optional),:]
-
Insert the looked up value from a field in the most recently added record that is completed, approved, and published, in a certain category by a certain user. You can also use the keyword this in place of the category or the user_id to refer to the category currently being used or the currently logged-in user, respectively. Examples: To show the contents of field three in the most recently saved record in the current category by the currently logged-in user: [:mostrecentlookup@3:] To show the contents of field seven for the most recently saved record that is completed, approved, and published by the currently logged-in user in category ten: [:mostrecentlookup@7,10:] To show the contents of field twenty-five for the record most recently saved by the user with username user1 in category five: [:mostrecentlookup@25,5,user1:] Note that the user_id can also be Joomla!'s id number for the user: [:mostrecentlookup@25,5,63:] Note that in the above examples, the looked up value will appear exactly as it does in the looked up field, including the effects of any field text formatting functions that may have been applied. To override the field text formatting functions that were applied to the original and to optionally apply new field text formatting functions, append an additional argument within the mostrecentlookup tag as follows: [:mostrecentlookup@field,category,user_id,nnnn:] Here, each n is a zero or a one. All four digits as zeroes will cause no field text formatting functions to be applied. The first n, set to 1, will cause "ALL UPPERCASE" to be applied to the looked up value. The second n, set to 1, will cause "all lowercase" to be applied to the looked up value. The third n, set to 1, will cause "Each Word Uppercase" to be applied to the looked up value. The fourth n, set to 1, will cause "First word uppercase" to be applied to the looked up value. Examples: To show the contents of field three in the most recently saved record in the current category by the currently logged-in user with no field text formatting functions applied, even though they may be applied in the original field: [:mostrecentlookup@3,this,this,0000:] To show the contents of field twenty-five in the record most recently saved in category five by the user with username user1, with "all lowercase " applied: [:mostrecentlookup@25,5,user1,0100:] |
|
Last Updated ( Thursday, November 19, 2009 )
|
|