Display Content Once in Foreach Loop

I am trying to make changes to the checkout, but i have run into a problem,

I have created the file:

profile_fields.pre.tpl and included my addition code, which is included in the checkout page however it is included several times as profile_fields uses a foreach loop.

so i assigned a variable to try an get the code to be only included once, in the loop

{if $adbbx_pcw != “disabled”}

{assign var=“adbbx_pcw” value=“disabled” scope=“global”}

[b]{/if} [/b]

however the code is still be included several times in the page.

anyone know how i can stop this from happening?