1. Home
  2. Docs
  3. Overview
  4. Intro to Template Variables

Intro to Template Variables

what are template variables?

The Quiz and Survey Master plug-in helps you by taking a lot of work out of your hands by creating key parts of your quiz or survey, but quizzes and surveys are always better if you can customize them as much as possible to your specific audience and purpose. For example, in a quiz, you will probably want to customize the way the results of your quiz are displayed, including adding things like the name of the quiz, the amount of questions they got right, and the correct answers.

But – these will be different for each quiz, each user, and each time that user takes the quiz. How do you add this information to your quiz without knowing what they are beforehand? This is the value of template variables: they allow you to put a variable in the content already set for your quiz or survey (your template) and that variable be replaced with the corresponding value when the user takes the quiz.

For example, when we write the results page template, we won’t be able to put the points the user has earned because the user hasn’t taken the quiz yet. So, we can put the variable %POINT_SCORE% into the results page. Then, when the user takes the quiz, the plugin will put the total points in place of the variable for you.

USING TEMPLATE VARIABLES

There are lots of variables you can use in your templates. Almost all of the template variables follow the same format, with percent signs at the beginning and end and the variable name in the middle, ex. %QUIZ_SCORE%  (Note that there are no spaces between the % and the name – that’s important!)

 

Each template includes a list of variables that work in that template. For example, the Message Displayed Before Quiz template can only have the variables %QUIZ_NAME% and %CURRENT_DATE%. So be sure to check which variables are allowed before you write that masterpiece in the template.

list of template variables

%POINT_SCORE% – this is used to show the amount of points a user earned during the quiz. For example:

%AVERAGE_POINT% – this is the average amount of points the user earned per question. For example:

%AMOUNT_CORRECT% – the amount of questions the user answered correctly. For example:

%TOTAL_QUESTIONS% – the total amount of questions that was displayed for the user. For example:

%CORRECT_SCORE% – the percentage score the user earned during the quiz. For example:

%USER_NAME% – the name the user entered into the Name text box. For example:

%USER_BUSINESS% – the company the user entered into the Business text box. For example:

%USER_PHONE% – the phone number the user entered into the Phone text box. For example:

%USER_EMAIL% – the email the user entered into the Email text box. For example:

%QUIZ_NAME% – the name of the quiz. For example:

%QUESTIONS_ANSWERS% – shows the questions, answers, and comments. This variable can be edited on the Text tab. An example of usage would be:

%COMMENT_SECTION%  – the text the user entered into the quiz comment section (if enabled). An example of usage would be:

%TIMER% – the amount of seconds the user took to complete the quiz. For example:

%CERTIFICATE_LINK% – the link to the certificate generated for the user (if enabled). For example:

%CATEGORY_POINTS%%/CATEGORY_POINTS% – the amount of points a user earned in a specific category. An example of usage would be:

%CATEGORY_SCORE%%/CATEGORY_SCORE% – the percentage score of questions the user answered correctly in a specific category. For example:

%CATEGORY_AVERAGE_POINTS% – the average amount of points the user earned between all categories.

%CATEGORY_AVERAGE_SCORE% – the average percentage score of questions the user answered in all categories. For example:

%FACEBOOK_SHARE% – displays the button to share on Facebook

%TWITTER_SHARE% – displays the button to share on Twitter