DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

Your own variables

Youcan declare own variables in TypoScript for your own template. This variables are here valid: page, questions, answers and the highscore/poll result list. This is important for even/odd interpretations. You can use “plugin.tx_myquizpoll_pi1.myVars.page.” in TEMPLATE_QUESTION_PAGE and TEMPLATE_RESULT_PAGE, “plugin.tx_myquizpoll_pi1.myVars.questions.” for questions, “plugin.tx_myquizpoll_pi1.myVars.answers.” for answers and “plugin.tx_myquizpoll_pi1.myVars.list.” for the highscore and the poll result list.

This variables can be used in your template at this way: ###MY_YOURVARIABLE###. Replace YOURVARIABLE with the name of your variable. Recommendation: take a look at the “template_analysis.html”.

:underline:`Note` : MY_SELECT (select-box), MY_OPTION (select- option), MY_INPUT_TEXT (text-answer), MY_INPUT_AREA (text-area), MY_INPUT_RADIO (radio-button), MY_INPUT_CHECKBOX (checkbox), MY_INPUT_WRAP (wrap the text of input-fields), MY_INPUT_ID and MY_INPUT_LABEL are reserved for questions and/or answers and can be set via TypoScript.Radio-buttons and check-boxes have no class- attribute. This is the only way to give them a class-attribute!Yes-no- boxes are automatically wrapped by the the classes tx_myquizpoll_pi1-yesno, -yes and -no.

Example 1:

TypoScript: myVars.questions.eo_align = tx_myquizpoll_pi1-right,tx_myquizpoll_pi1-left

HTML-Template, area ###TEMPLATE_QUESTION###: <div class="###MY_EO_ALIGN###">

This means: ###MY_EO_ALIGN### will be replaced by “tx_myquizpoll_pi1-right” for odd questions (question 1,3,5,...) and “tx_myquizpoll_pi1-left” for even questions (question 2,4,6,...).

Example 2:

TypoScript: myVars.answers.align = left,center,right,center,left

HTML-Template, area ###TEMPLATE_QRESULT###: <p align="###MY_ALIGN###">

This means: ###MY_ALIGN### will be replaced by “left” for the 1st and 5th answer of a question, “center” for the 2nd and 4 th answer and “right” for the 3th answer of every question.

Example 3:

TypoScript: myVars.list.even_odd = -odd,-even

Template ###TEMPLATE_HIGHSCORE_ENTRY###: <tr class="###PREFIX###-tr###MY_EVEN_ODD###">

This means: ###MY_EVEN_ODD### will be replaced by “-odd” for odd rows and “-even” for even rows.

Example 4:

TypoScript:myVars.answers.input_radio = onclick="changeBG();" style="float: right;"

The style- and onclick-Attribute will be added to every radio-button of a question.

Example 5:

TypoScript:myVars.answers.input_wrap = <label for=”answer1”>|</label>,<label for=”answer2”>|</label>

You can wrap the text of radio-buttons and check-boxes.

Example 6:

TypoScript:myVars.answers.input_id = 1andmyVars.answers.input_label = 1

Automatically wraps the radio-buttons and check-boxes with a label- field and sets an ID for every input-field.With “input_label = 2” the label will wrap the input-field and the text!

Example 7:

TypoScript:myVars.answers.select= class=”select- box”ormyVars.answers.input_area = cols=”33” rows=”5”

All select-boxes of the quiz will get the class “select-box”; size for textareas.

Example 8:

TypoScript:myVars.page.name= Test-quiz

You can use this variable in the page-template as ###MY_NAME###.