Heh, no, using $CNT after the `=` does not work because twig doesn't allow `$` in variable names. We change `$VAR` in `<!-- DEFINE $VAR = 0 -->` to `definition.VAR` before twig parses the template. All others are left unchanged. I agree that this is rather ugly. We can use a macro, resulting in:

```
								<!-- IF postrow.U_PM -->{% set CNT = CNT + 1 %}
									{{ body.contact_icon(CNT, postrow.U_PM, 'contact', L_PRIVATE_MESSAGE) }}
								<!-- ENDIF -->
								<!-- IF postrow.U_EMAIL -->{% set CNT = CNT + 1 %}
									{{ body.contact_icon(CNT, postrow.U_EMAIL, 'email', L_SEND_EMAIL_USER ~ postrow.POST_AUTHOR) }}
								<!-- ENDIF -->
								<!-- IF postrow.U_JABBER -->{% set CNT = CNT + 1 %}
									{{ body.contact_icon(CNT, postrow.U_JABBER, 'jabber', L_JABBER, 'popup(this.href, 550, 320); return false;') }}
								<!-- ENDIF -->
								<!-- BEGIN custom_fields -->
									<!-- IF postrow.custom_fields.S_PROFILE_CONTACT -->{% set CNT = CNT + 1 %}
										<!-- IF postrow.custom_fields.PROFILE_FIELD_CONTACT -->
											{% set HREF = postrow.custom_fields.PROFILE_FIELD_CONTACT %}
										<!-- ELSE -->
											{% set HREF = postrow.U_POST_AUTHOR %}
										<!-- ENDIF -->
										{{ body.contact_icon(CNT, HREF, postrow.custom_fields.PROFILE_FIELD_IDENT, postrow.custom_fields.PROFILE_FIELD_NAME) }}
									<!-- ENDIF -->
								<!-- END custom_fields -->
							<!-- IF CNT % 4 != 0 --></div><!-- ENDIF -->
```

`{% set CNT = CNT + 1 %}` is still done every time because we can't modify the variable inside the macro. We also hit another wall... we can't use L_ variables as parameters.