Advanced F2C templating with Smarty
Article templating can be more than just a question of copy/pasting information from the submission form into the Joomla article. Using the Smarty template engine and some nice F2C template parameters there is a lot more possible.
Conditional statements using single select lists (drop down)
![]()
The single select list field type is available both in F2C Lite and Pro. The following example shows how you can create different conditional statements based on the choice made by the submitter.
Single select list settings
When the single select list is used there are two columns in the field type settings. One is the 'option value', the other is the 'option display text' (see image). The choice made can be rendered in two ways into the article.
Option value (latin characters, no spacing): {$FIELDNAME}
Option display text: {$FIELDNAME_TEXT}
Example: Gender choice determining article content
In this example we will assume there is a single select list field type with unique field name GENDER. The values are 1: Male, 2: Female (as in the above image).
In our article we want our text to refer to 'him' or 'her' and 'his' or 'hers'.
Article text to create: "This box is his/hers, it therefore doesn't belong to him/her." The example will show the use of both the value and text option.
The above code can render 3 options:
- This box is his, it therefore doesn't belong to her. (Male selected)
- This box is hers, it therefore doesn't belong to him. (Female selected)
- This box is someones, it therefore doesn't belong to you. (Nothing selected)
Of course there are many variants on display or hiding the entire option if nothing is selected. Extended Smarty documentation about conditions and possible syntax can be found here:http://www.smarty.net/manual/en/language.function.if.php
Conditional statements using multi-select lists (check boxes)
The multi-select list field type is available both in F2C Pro. The following example shows how you can create different conditional statements based on the choice made by the submitter.

